Last updated

Implementing or dismissing opportunities

The Opportunities API enables you to perform actions on the opportunities you retrieve. You can:

  • Implement opportunities.
  • Mark opportunities as implemented.
  • Dismiss opportunities.

→ If you want to retrieve the opportunities for a property or retrieve the eligible properties for a specific opportunity, see retrieving opportunities.

Implementing or dismissing an opportunity

POST
https://supply-xml.booking.com/opportunity-api/properties/{property_id}/opportunities

The POST /properties/{property_id}/opportunities request enables you to perform an action on a specified opportunity for a property.

Which actions you can perform depends on the implementation type of the opportunity. You can see the implementation type in the response object when retrieving opportunities:

  • TOGGLE enables you to act upon opportunities solely through the API with the following actions:

    • Enable: Implements opportunity for specified property or properties.
    • Dismiss: Causes opportunity for specified property or properties to disappear.
Dismissed opportunities show up in the opportunity center

Opportunities that were dismissed via the API will not be returned in the actionable opportunities via the GET call. However, they will still show up in the opportunity center of the property in the Booking.com extranet.

  • REDIRECT enables you to implement the opportunity in two ways: (1) It informs you of what API you must use (destination API), or (2) it contains a URL that redirects you to the appropriate extranet page of the specified property. You can still perform the following action through the Opportunities API:

    • Dismiss: Causes opportunity for specified property or properties to disappear.
You cannot dismiss `PROVIDER` opportunities

You cannot dismiss PROVIDER type opportunities via the Opportunities API. Because of their time-sensitive nature, they disappear themselves when they're no longer valid.

Header parameters

The following table lists the header parameters in the request:

ParameterDescriptionTypeRequired/OptionalNotes
AuthorizationMachine account username and passwordstringRequiredExample: Authorization: Basic {username:password}

Body parameters

The following table describes what elements you must add in the request body:

ElementDescriptionTypeRequired/OptionalNotes
actionsContains the information related to the action upon a specific opportunity.arrayrequired
opportunity_idSpecifies the unique ID of the opportunity.stringrequired
actionSpecifies the action that you want to perform upon the opportunity.enumrequiredPossible values are: ENABLE (implement opportunity for specified property) and DISMISS (avoid seeing this opportunity again for specified property).

Request body example

The following is a request body example where you implement a toggle opportunity for a property with ID 12345 (as you can see in the cURL request below this example):

{
"actions" :[{
   "opportunity_id":"cucc_adoption_oc_promotion",
   "action":"ENABLE"
   }]
}

Sample request

You can find an example request in cURL here:

curl -X POST \
  https://supply-xml.booking.com/opportunity-api//properties/12345/opportunities \
  -H 'Authorization: Basic Xxxxxxxxxxx' \

Sample response

{
"data": {}
"meta": {
    "ruid": "UmFuZG9tSVYkc2RlIyh9YbvPzfY4dZasPGAUcglKEyRzk2/HbSzspV7O+mQdkB4hP2dlEyQkjV+iI71VQFka7vNa5MAta305nepI2yvXTv4="
},
"errors": [],
"warnings": []
}

Response body

The following table describes the elements of the response body:

ElementDescriptionTypeNotes
dataContains the response data.object
metaContains the meta data that comes with the response.object
ruidSpecifies the unique ID of the request.stringYou can send this ID to Booking.com customer support if you run into an issue. This can help to understand what went wrong.
errorsContains potential errors. These can help you understand what went wrong with your request.array
warningsContains potential warnings. These can help you improve your requests.array

Implementing or dismissing opportunities in bulk

POST
https://supply-xml.booking.com/opportunity-api/opportunities

The POST /opportunities request enables you to perform actions on specified TOGGLE opportunity and property combinations in bulk.

→ If you want more information on TOGGLE and REDIRECT, see implementing or dismissing an opportunity

Header parameters

The following table lists the header parameters in the request:

ParameterDescriptionTypeRequired/OptionalNotes
AuthorizationMachine account username and passwordstringRequiredExample: Authorization: Basic {username:password}

Body parameters

The following table describes what elements you must add in the request body. You must specify these elements for each opportunity and property combination:

ElementDescriptionTypeRequired/OptionalNotes
actionsContains the information related to the action upon a specific opportunity.arrayrequired
opportunity_idSpecifies the unique ID of the opportunity.stringrequired
actionSpecifies the action that you want to perform upon the opportunity.enumrequiredPossible values are: ENABLE (implement opportunity for specified property) and DISMISS (avoid seeing this opportunity again for specified property).
property_idSpecifies the unique ID of the property to which the opportunity belongs.stringrequired

Request body example

The following is a request body example where you implement and dismiss opportunities in bulk:

{
"actions" :[{
   "opportunity_id":"cucc_adoption_oc_promotion",
   "action":"ENABLE",
   "property_id": "12345"
   },
   {
   "opportunity_id": "cucc_adoption_oc_promotion",
   "action": "ENABLE",
   "property_id": "54321"
   },
   {
   "opportunity_id": "nocvc",
   "action": "DISMISS",
   "property_id": "21349"
   }]
} 

Sample request

You can find an example request in cURL here:

curl -X POST \
  https://supply-xml.booking.com/opportunity-api/opportunities \
  -H 'Authorization: Basic Xxxxxxxxxxx' \

Sample response

{
"data": {}
"meta": {
    "ruid": "UmFuZG9tSVYkc2RlIyh9YbvPzfY4dZasPGAUcglKEyRzk2/HbSzspV7O+mQdkB4hP2dlEyQkjV+iI71VQFka7vNa5MAta305nepI2yvXTv4="
},
"errors": [],
"warnings": []
}

Response body

The following table describes the elements of the response body:

ElementDescriptionTypeNotes
dataContains the response data.object
metaContains the meta data that comes with the response.object
ruidSpecifies the unique ID of the request.stringYou can send this ID to Booking.com customer support if you run into an issue. This can help to understand what went wrong.
errorsContains potential errors. These can help you understand what went wrong with your request.array
warningsContains potential warnings. These can help you improve your requests.array