# Property License Retrieve Rule (With property id)

This endpoint allows you to retrieve the license rule details for a specific property based on the hotel and channel-specific hotel ID.

***

### <mark style="color:yellow;">Endpoint</mark>

<mark style="color:green;background-color:green;">**`POST`**</mark>&#x20;

<div align="left"><figure><img src="https://958347541-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM9bn2UcBkeqtqixkl5eF%2Fuploads%2FpsybX0n39kUB8Z8WOk4X%2FSandbox%20image.png?alt=media&#x26;token=4ae73d0f-0d1a-4d73-a4e2-673dbc081d6a" alt="" width="56"><figcaption></figcaption></figure></div>

{% code overflow="wrap" %}
```url
https://connect-sandbox.su-api.com/SUAPI/jservice/bdc/property/license/retrieveRule
```
{% endcode %}

#### <mark style="color:yellow;">Header</mark>

```xml
-app-id: YOUR_APP_ID
Authorization: YOUR_API_KEY
Content-Type:application/json
```

<table><thead><tr><th width="185">Header</th><th width="85">Type</th><th width="101">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>app-id</code></td><td>string</td><td>Yes</td><td>Your application ID. Required for authentication.</td></tr><tr><td><code>Authorization</code></td><td>string</td><td>Yes</td><td>Your API key. for authorization. Required for authentication.</td></tr><tr><td><code>Content-Type</code></td><td>string</td><td>Yes</td><td>Must be set to <code>application/json</code>.</td></tr></tbody></table>

***

#### <mark style="color:yellow;">Attributes</mark>

`hotel_id` <mark style="color:orange;">**string (Required)**</mark>

Specifies the hotel ID for the property.

***

`channel_hotel_id` <mark style="color:orange;">**string (Required)**</mark>

Specifies the channel-specific hotel ID for the property.

***

## <mark style="color:yellow;">**Sample Request**</mark>

```json
{
    "hotel_id": "new1",
    "channel_hotel_id": "12926584"
}
```

***

## <mark style="color:yellow;">Response</mark>

#### <mark style="color:green;">**Sample Success Response**</mark>

```json
{
    "Status": "Success",
    "Data": {
        "variants": [
            {
                "name": "paris_new_license_private_person",
                "id": 319,
                "content": [
                    {
                        "format": "^75[0-9]{11}$",
                        "name": "number",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "license_holder_first_name",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "license_holder_last_name",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "street_name",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "street_number",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "additional_address_info",
                        "required": false,
                        "dataType": "string"
                    },
                    {
                        "name": "residence_type",
                        "required": true,
                        "dataType": "string",
                        "possibleValues": [
                            "primary",
                            "secondary",
                            "other"
                        ]
                    }
                ]
            },
            {
                "name": "paris_new_license_company",
                "id": 320,
                "content": [
                    {
                        "format": "^75[0-9]{11}$",
                        "name": "number",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "license_holder_company_name",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "street_name",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "street_number",
                        "required": true,
                        "dataType": "string"
                    },
                    {
                        "name": "additional_address_info",
                        "required": false,
                        "dataType": "string"
                    },
                    {
                        "name": "residence_type",
                        "required": true,
                        "dataType": "string",
                        "possibleValues": [
                            "primary",
                            "secondary",
                            "other"
                        ]
                    }
                ]
            },
            {
                "name": "paris_new_exception",
                "id": 321,
                "content": [
                    {
                        "name": "exception_type",
                        "required": true,
                        "dataType": "string",
                        "possibleValues": [
                            "mobility_lease",
                            "dependent_room",
                            "bed_breakfast"
                        ]
                    }
                ]
            }
        ],
        "name": "paris_new",
        "id": 214,
        "active": true,
        "level": "room"
    },
    "Message": "License Rule fetched successfully"
}
```

#### <mark style="color:yellow;">Success Response Body Elements</mark>

`Status` <mark style="color:orange;">**string**</mark>

Indicates the result of the API call.

***

`Data` <mark style="color:orange;">**object**</mark>

This parameter contains the main body of the response and includes all relevant information regarding the license rule variants for the property.&#x20;

It consists of the following sub-parameters:

`variants` <mark style="color:orange;">**array**</mark>

An array containing different license rule variants.&#x20;

Each variant has the following parameters:

`name` <mark style="color:orange;">**string**</mark>

The name of the license rule variant.

{% hint style="info" %}
For example, `paris_new_license_private_person` or `paris_new_license_company`
{% endhint %}

`id` <mark style="color:orange;">**integer**</mark>

A unique identifier for the license variant.

`content` <mark style="color:orange;">**array**</mark>

An array of fields that belong to the license variant, with specific validation rules.

Each field in **content** includes the following parameters:

`format` <mark style="color:orange;">**string**</mark>

A regular expression pattern used for validating the field value.&#x20;

{% hint style="info" %}
For example, `"^75[0-9]{11}$"` for validating a `number` field.
{% endhint %}

`name` <mark style="color:orange;">**string**</mark>\
The name of the field&#x20;

{% hint style="info" %}
For example, `number`, `license_holder_first_name`
{% endhint %}

`required` <mark style="color:orange;">**boolean**</mark>

Specifies if the field is required (`true`) or optional (`false`).

`dataType` <mark style="color:orange;">**string**</mark>

The data type of the field.

{% hint style="info" %}
For example,  `string, integer.`
{% endhint %}

`possibleValues` <mark style="color:orange;">**array**</mark>

A list of valid values for fields that have predefined options.&#x20;

{% hint style="info" %}
For instance, for the `residence_type` field, the possible values might include `"primary"`, `"secondary"`, and `"other"`.
{% endhint %}

`name` <mark style="color:orange;">**string**</mark>\
The name of the license rule set, such as `"paris_new"`.&#x20;

This is a descriptive name identifying the particular set of rules.

`id` <mark style="color:orange;">**integer**</mark>

A unique identifier for the license rule set.

`active` <mark style="color:orange;">**boolean**</mark>

Indicates whether the license rule set is active.&#x20;

{% hint style="info" %}
Possible values are `true` (active) or `false` (inactive).
{% endhint %}

`level` <mark style="color:orange;">**string**</mark>

Specifies the level at which the license rule is applied&#x20;

{% hint style="info" %}
For example, `room`, `property.`
{% endhint %}

`Message` <mark style="color:orange;">**string**</mark>

A string containing a message that gives more context or feedback about the success of the request.&#x20;

In this case, the message is `"License Rule fetched successfully"`, indicating that the license rule set has been successfully retrieved.

***

#### <mark style="color:red;">Errors</mark>

<mark style="color:red;">**Sample Error Response 1 - Validation Error Response**</mark>

```json
{
    "Status": "Fail",
    "Errors": [
        {
            "Code": "400",
            "ShortText": "hotel_id: Invalid HotelCode ('')"
        },
        {
            "Code": "572",
            "ShortText": "channel_hotel_id - is invalid or not found!"
        }
    ],
    "Message": ""
}
```

***

<mark style="color:yellow;">**Error Response Body Elements**</mark>

`Status` <mark style="color:orange;">**string**</mark>

Indicates the result of the API call, which will be always `"Fail"` in case of an error response.

***

`Error` <mark style="color:orange;">**array**</mark>

Array that contains details about any errors that occurred during the API call. Each object in the `Errors` array contains the following properties:

`Code` <mark style="color:orange;">**string**</mark>

Specific error code that helps identify the type of error.

{% hint style="info" %}
For example: `"400"` indicates a bad request.
{% endhint %}

`ShortText` <mark style="color:orange;">**string**</mark>

A short description of the error.

***

`Message` <mark style="color:orange;">**string**</mark>

A message providing more information about the error.
