Restrictions
Get all restrictions
Returns all restrictions of the default service provided by the enterprise. Note this operation uses Pagination and supports Portfolio Access Tokens.
Request
[PlatformAddress]/api/connector/v1/restrictions/getAll
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Token identifying the client application. |
| string | required | Access token of the client application. |
| string | required | Name and version of the client application. |
| array of string | optional, max 1000 items | Unique identifiers of the Enterprises. If not specified, the operation returns data for all enterprises within scope of the Access Token. |
| array of string | required, max 1000 items | Unique identifiers of the Services from which the restrictions are requested. |
| array of string | optional, max 1000 items | Unique identifiers of Resource categories. |
| array of string | optional, max 1000 items | Unique identifiers of Rates. Returns all restrictions that affect the given rates, i.e. ones without any Restriction Conditions, ones assigned directly to specified rates, ones assigned to Rate groups of specified rates, or ones inherited from base rates. |
| array of string | optional, max 1000 items | Unique identifiers of Rates. Returns only those restrictions which have matching |
| array of string | optional, max 1000 items | Unique identifiers of Rates. Returns only those restrictions which have matching |
| string | optional | Restriction origin. Returns only those restrictions which have matching |
| optional, max length 3 months | Interval in which the Restriction is active. Required if no other filter is provided. | |
| optional, max length 3 months | Interval in which the Restriction was created. | |
| optional, max length 3 months | Interval in which the Restriction was updated. | |
| required | Limitation on the quantity of data returned. |
Response
Property | Type | Contract | Description |
---|---|---|---|
| array of Restriction | required | Restrictions of the default service. |
| string | optional | Unique identifier of the item one newer in time order than the items to be returned. If Cursor is not specified, i.e. null, then the latest or most recent items will be returned. |
Restriction
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Unique identifier of the restriction. |
| string | required | Unique identifier of the Service. |
| string | optional | External identifier of the restriction. |
| string | required | |
| required | The conditions or rules that must be met by a reservation for the restriction to apply. | |
| optional | The rules that prevent the restriction from applying to a reservation, even when all conditions have been met. |
Restriction Conditions
Property | Type | Contract | Description |
---|---|---|---|
| string | required | |
| string | optional | Unique identifier of the restricted exact Rate. |
| string | optional | Unique identifier of the restricted base Rate. |
| string | optional | Unique identifier of the restricted Rate group. |
| string | optional | Unique identifier of the restricted Resource category. |
| string | optional | Name of the restricted Resource category type. |
| string | optional | Start date of the restriction time interval, specified in ISO 8601 format and adjusted to UTC - see Datetimes for important information on format and implementation. |
| string | optional | End date of the restriction time interval, specified in ISO 8601 format and adjusted to UTC - see Datetimes for important information on format and implementation. |
| array of string Day | optional | The restricted days of week. Will automatically be set to all values when not provided or when the service uses a time unit longer than a day. |
Restriction Exceptions
Property | Type | Contract | Description |
---|---|---|---|
| string | optional | The minimum time before the reservation starts, you can reserve in ISO 8601 duration format. |
| string | optional | The maximum time before the reservation starts, you can reserve in ISO 8601 duration format. |
| string | optional | Minimal reservation length in ISO 8601 duration format. |
| string | optional | Maximal reservation length in ISO 8601 duration format. |
| optional | Value of the minimum price per time unit. | |
| optional | Value of the maximum price per time unit. |
Day
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Restriction type
Stay
- guests can't stay within specified dates.Start
- guests can't check in within specified dates.End
- guests can't check out within specified dates.
Restriction origin
User
- Restriction was created by a user in Mews.Integration
- Restriction was created by a 3rd-party integration.
Add restrictions
Adds new restrictions with the specified conditions. Note care is needed to specify StartUtc
and EndUtc
in the correct format - see Datetimes.
Important: If consecutive restrictions are sent with the exact same conditions and exceptions, no attempt at merging them into a single restriction is made. This means that there can be a large number of restrictions per service, leading to sub-optimal performance. A quota limit of 150000 has been introduced for this reason. To mitigate the issue, the preferred way to add restrictions is new operation Set restrictions. The new operation is currently marked as 'Restricted' and subject to change as part of beta testing, but in time we expect that to replace Add restrictions.
Request
[PlatformAddress]/api/connector/v1/restrictions/add
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Token identifying the client application. |
| string | required | Access token of the client application. |
| string | required | Name and version of the client application. |
| string | required | Unique identifier of the Service restrictions will be added in. |
| array of Restriction parameters | required | Parameters of restrictions. |
Restriction parameters
Property | Type | Contract | Description |
---|---|---|---|
| string | optional | Identifier of the restriction within the transaction. |
| string | optional | External identifier of the restriction. |
| required | The conditions or rules that must be met by a reservation for the restriction to apply. | |
| optional | The rules that prevent the restriction from applying to a reservation, even when all conditions have been met. |
Response
Property | Type | Contract | Description |
---|---|---|---|
| array of Added restriction | required | The added restrictions. |
Added restriction
Property | Type | Contract | Description |
---|---|---|---|
| string | optional | Identifier of the restriction within the transaction. |
| required | The added restriction. |
Delete restrictions
Removes restrictions from the service.
Request
[PlatformAddress]/api/connector/v1/restrictions/delete
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Token identifying the client application. |
| string | required | Access token of the client application. |
| string | required | Name and version of the client application. |
| array of string | required | Unique identifiers of the Restrictions. |
Response
Set restrictions
Restricted!This operation is currently in beta-test and as such it is subject to change. Use of this operation must be enabled per enterprise. Please contact the Technical Partner Support team in order to enable it.
Adds new restrictions with the specified conditions. For improved efficiency, multiple similar restrictions will be merged into a single restriction - see Merging algorithm. A quota of 150000 restrictions per service applies, although it is unlikely to be exceeded because of the Merging algorithm. Note care is needed to specify StartUtc
and EndUtc
in the correct format - see Datetimes. The validation of these properties is stronger in this operation than for Add restrictions.
Merging algorithm
If a restriction already exists with the same conditions, or if multiple supplied restrictions match in all properties but differ in time interval and follow each other chronologically, a merging algorithm is applied to combine them. This reduces the overall number of restrictions and improves system performance. The merging algorithm is as follows:
A. If the exceptions of the new restriction match the old restriction:
If the new interval is longer than the old one, a new restriction is created joining the two intervals.
If the new interval is shorter, no changes are made.
B. If the exceptions of the new restriction do not match the old restriction:
If the new interval overlaps the old interval, the old restriction will be spliced before and after the new interval. Restrictions matching the old restriction are then added at the appropriate interval along with the new restriction.
If the new interval does not overlap the old interval, the new restriction is added as usual.
Affected restrictions
Only restrictions created through the API are affected by this operation, not restrictions created by the user within Mews Operations. Similarly, if a user creates a restriction in Mews Operations, this will not affect restrictions created through the API.
Request
[PlatformAddress]/api/connector/v1/restrictions/set
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Token identifying the client application. |
| string | required | Access token of the client application. |
| string | required | Name and version of the client application. |
| string | required | Unique identifier of the Service restrictions will be set in. |
| array of Restriction set data | required | Parameters of restrictions. |
Restriction set data
Property | Type | Contract | Description |
---|---|---|---|
| string | required | |
| string | optional | Unique identifier of the restricted exact Rate. |
| string | optional | Unique identifier of the restricted base Rate. |
| string | optional | Unique identifier of the restricted Rate group. |
| string | optional | Unique identifier of the restricted Resource category. |
| string | optional | Name of the restricted Resource category type. |
| string | optional | Start date of the restriction time interval, specified in ISO 8601 format and adjusted to UTC - see Datetimes for important information on format and implementation. |
| string | optional | End date of the restriction time interval, specified in ISO 8601 format and adjusted to UTC - see Datetimes for important information on format and implementation. |
| required | The restricted days of week. | |
| string | optional | The minimum time before the reservation starts, you can reserve in ISO 8601 duration format. |
| string | optional | The maximum time before the reservation starts, you can reserve in ISO 8601 duration format. |
| string | optional | Minimal reservation length in ISO 8601 duration format. |
| string | optional | Maximal reservation length in ISO 8601 duration format. |
| optional | Value of the minimum price per time unit. | |
| optional | Value of the maximum price per time unit. |
Clear restrictions
Restricted!This operation is currently in beta-test and as such it is subject to change. Use of this operation must be enabled per enterprise. Please contact the Technical Partner Support team in order to enable it.
Deletes restrictions that match the conditions using the splicing algorithm. This operation is intended to be used alongside Set restrictions.
The specified conditions must be met exactly - see Matching conditions below. The time interval, however, does not need to correspond with an existing restriction in the system, instead the API uses a splicing algorithm to work out how to divide up any existing restrictions to meet the specified time interval - see Time interval splicing.
Matching conditions
The specified conditions must be met exactly. For example:
A bookable service has two restrictions A and B. Restriction A applies to resource category C1 and rate R1. Restriction B applies to resource category C1 and to all rates.
If the Clear restrictions operation is called, specifying a restriction condition of resource category C1 but with no rate specified (this defaults to all rates), then only Restriction B is cleared, not Restriction A.
Time interval splicing
The time interval does not need to correspond to an existing restriction in the system, instead the API uses a splicing algorithm to work out how to divide up any existing restrictions to meet the specified time interval. For example:
An existing restriction in the system applies from 5th January to 25th January. As usual, time intervals are inclusive, meaning that the time interval includes both the 5th January and the 25th January.
If the Clear restrictions operation is called, specifying a restriction time interval of 10th January to 20th January, i.e. within the original restriction A, then the time interval of restriction A is split into three separate intervals.
The original restriction A is deleted, and in its place new restriction B is created for the period of time from 5th January to 9th January inclusive, and new restriction C is created for the period of time from 21st January to 25th January. Thus the period 10th January to 20th January has been cleared, but without affecting other time periods.
Affected restrictions
To avoid deleting user defined restrictions, the Clear restrictions operation only affects restrictions created through the Set restrictions operation or the Clear restrictions operation.
Request
[PlatformAddress]/api/connector/v1/restrictions/clear
Property | Type | Contract | Description |
---|---|---|---|
| string | required | Token identifying the client application. |
| string | required | Access token of the client application. |
| string | required | Name and version of the client application. |
| string | required | Unique identifier of the Service to which the restrictions apply. |
| Array of Restriction clear data | required | Details of the matching conditions and time intervals for clearing restrictions. |
Restriction clear data
Property | Type | Contract | Description |
---|---|---|---|
| string | required | |
| string | optional | Unique identifier of the exact Rate to which the restriction applies. |
| string | optional | Unique identifier of the base Rate to which the restriction applies. |
| string | optional | Unique identifier of the Rate group to which the restriction applies. |
| string | optional | Unique identifier of the Resource category to which the restriction applies. |
| string | optional | Name of the Resource category type to which the restriction applies. |
| string | optional | Start date of the time interval for which the restriction conditions should be applied. This must be in UTC timezone in ISO 8601 format - see Datetime. |
| string | optional | Inclusive end date of the time interval for which the restriction conditions should be applied. This must be in UTC timezone in ISO 8601 format - see Datetime. |
| required | The days of week to which the restriction applies. |
Response
Days parameters
Property | Type | Contract | Description |
---|---|---|---|
| boolean | required | Monday enabled. |
| boolean | required | Tuesday enabled. |
| boolean | required | Wednesday enabled. |
| boolean | required | Thursday enabled. |
| boolean | required | Friday enabled. |
| boolean | required | Saturday enabled. |
| boolean | required | Sunday enabled. |
Last updated