# codegroups (B.XML)

This call is intended to be used by the Connectivity Partner in order to retrieve an XML list of all codes (or codes from specified 'codegroups') that are used in Booking.com APIs.  Since applicable information for each 'codegroup' varies, Connectivity Partners should be flexible to accept the addition of new elements/attributes and changes as the data may be updated over time.

## Step 1: Request for a list of API codes


```http
POST https://supply-xml.booking.com/hotels/xml/codegroups
```

### Request — HTTP Message Body Model (All 'codegroups')


```xml
<?xml version="1.0" encoding="UTF-8"?>
<request>
  <username>providermachinelogin</username>
  <password>********</password>
</request>
```

### Request — HTTP Message Body Model (Selected 'codegroups' only)


```xml
<?xml version="1.0" encoding="UTF-8"?>
<request>
  <username>providermachinelogin</username>
  <password>********</password>
  <minified>yes</minified>
  <codegroups>
    <codegroup>BCL</codegroup>
    <codegroup>UIT</codegroup>
  </codegroups>
</request>
```

### Request — Node Overview

| Node Name | Nest Level | Parent Node | Value Range | Data Type | Node Multiplicity |
|  --- | --- | --- | --- | --- | --- |
| codegroup | L2 | codegroups | [see below] | string | 0..X |
| codegroups | L1 | request | -- | -- | 0..1 |
| minified | L1 | request | [see below] | boolean | 0..1 |
| password | L1 | request | -- | string | 1 |
| request | L0 | NULL(root) | -- | -- | 1 |
| username | L1 | request | -- | string | 1 |


* The request body consists of a mandatory **request** root element.  This is the parent node to the required **username** and **password** nodes, as well as the optional **minified** and **codegroups** nodes.
* The mandatory child node **username** contains the authorized machine account login of the Connectivity Partner.
* The mandatory child node **password** contains the authorized machine account password of the Connectivity Partner.
* The optional child node **minified** accepts boolean values which may be represented as: '1', 'yes', or 'true' as valid input for 'True' --  and: '0', 'no', or 'false' as valid input for 'False'. By default 'minified' output is enabled ('True') and no XML structural whitespace characters are returned.
* The optional child node **codegroups** contains the optional child node(s) of **codegroup**.
* The optional grandchild node **codegroup** accepts one valid, specified code for a code group. If it is an OTA code group implemented on Booking.com, this would be the corresponding OTA 2014B-1.0 code for the group. At the time of writing, accepted OTA **codegroup** codes are: 'ACC', 'CHG', 'CUI', 'ERR', 'FTT', 'HAC', 'ITT', 'MPT', 'OTC', 'PCT', 'PTT', 'RMA', 'TRP', and 'UIT'.  Please note that these codegroups can contain extended Booking.com specific codes, usually beginning at code 5000+.  Accepted Booking.com specific code groups generally start with the letters 'BC'. At the time of writing, accepted Booking.com **codegroup** codes are: 'BCBT', 'BCCP', 'BCIO', 'BCJT', 'BCL', 'BCPT', and 'BCRT'. The multiplicity of this node can be up to the number of valid codegroup codes (21 at the time of writing).


### cURL model


```bash
curl -H "Host: providerhostname" \
-H "Connection: keep-alive" \
-H "Content-Length: XXX" \
-H "Cache-Control: no-cache" \
-H "Origin: XXXXXXXXXXXXX" \
-H "User-Agent: Provider User-Agent name" \
-H "Content-Type: text/xml;charset=UTF-8" \
-H "Accept: */*" \
-H "Accept-Encoding: gzip,deflate" \
--http1.1 \
-d @messagebody.xml -X POST \
'https://supply-xml.booking.com/hotels/xml/codegroups'
```

## Step 2: Response of a list of codes per code group

| Type | HTTP Method | Message Sender | Message Receiver |
|  --- | --- | --- | --- |
| Response | POST | Booking.com | Connectivity Partner |


### Response — HTTP Message Body Sample


```xml
<codegroups>
  <codegroup>
    <codegroup_description>Language Codes</codegroup_description>
    <codegroup_name>BCL</codegroup_name>
    <codes>
      <code>
        <description>Arabic</description>
        <origin>Booking</origin>
        <value>ar</value>
      </code>
      <code>
        <description>Azerbaijani</description>
        <origin>Booking</origin>
        <value>az</value>
      </code>
      <code>
        <description>Bulgarian</description>
        <origin>Booking</origin>
        <value>bg</value>
      </code>
       . . .
    </codes>
  </codegroup>
  <codegroup>
    <codegroup_description>Unique ID Codes</codegroup_description>
    <codegroup_name>UIT</codegroup_name>
    <codes>
      <code>
        <description>Hotel</description>
        <origin>OTA</origin>
        <value>10</value>
      </code>
    </codes>
  </codegroup>
</codegroups>
<!-- RUID: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] -->
```

### Response — Node Overview

| Node Name | Nest Level | Parent Node | Value Range | Data Type | Node Multiplicity |
|  --- | --- | --- | --- | --- | --- |
| codegroup | L1 | codegroups | -- | string | 0..X |
| codegroups | L0 | NULL(root) | -- | -- | 1 |
| codegroup_created | L2 | codegroup | [see below] | string | 0..1 |
| codegroup_description | L2 | codegroup | -- | string | 1 |
| codegroup_name | L2 | codegroup | -- | string | 1 |
| code | L3 | codes | [see below] | -- | 1..X |
| codes | L2 | codegroup | -- | -- | 1 |
| created | L4 | code | [see below] | string | 0..1 |
| description | L4 | code | -- | string | 0..1 |
| notes | L4 | code | -- | string | 0..1 |
| origin | L4 | code | -- | string | 1 |
| value | L4 | code | -- | string | [see below] |
| XXXXXX | L4 | code | [see below] | string | 0..1 |


* The response body consists of a **codegroups** root element.  This is the parent node to the **codegroup** node, whose multiplicity is determined by the number of codegroups available, or the number of codegroups requested.
* The child node **codegroup** contains the  nodes **codegroup_description**, **codegroup_name**, **codes**, and the optional node of **codegroup_created**.
* The optional grandchild node **codegroup_created** contains a 'YYYY-MM-DD' value when the value has been set to something other than a default date/time of first release.  This can then be used by the provider for monitoring new **codegroup** additions/changes on Booking.com.
* The grandchild node **codegroup_description** contains human readable text describing the given **codegroup**.
* The grandchild node **codegroup_name** contains the code of the **codegroup** requested.
* The grandchild node **codes** contains the **code** node(s) for the specified **codegroup**.
* The great-grandchild node **code** contains the **description**, **origin**, and **value** nodes, as well as optional **created** and other code-specific nodes (XXXXXX) which contain specific information relevant to the **code**.
* The optional great-great-grandchild node **created** contains a 'YYYY-MM-DD' value when the value has been set to something other than a default date/time of first release. This can then be used by the provider for monitoring new **code** additions to Booking.com.
* The optional great-great-grandchild node **description** contains the human readable description of what the specific **code** represents.
* The optional great-grandchild node **notes** provides additional, relevant information about the **code** not in the **description**.
* The great-great-grandchild node **origin** contains the information of where the code was sourced. At the time of writing, either 'OTA' for the Open Travel Alliance or 'Booking' for Booking.com.
* The great-great-grandchild node **value** contains the value (the code) to be used in a supported API.  Its human readable explanation can be found in its sibling node **description**.
* **XXXXXX** on the table represents any other descriptive information child nodes of the **code** node.  For example, the PCT group contains both an **ota_description** and **bcom_description** as part of its **code** element so that providers may see how the OTA description is mapped to Booking.com description. See table below.


### Unique **code** child nodes per **codegroup**

| code child element | codegroup |
|  --- | --- |
| after_deadline_nights | BCCP |
| bcom_description | PCT |
| cancellation_type | BCCP |
| deadline_hours | BCCP |
| leg_elements_optional | TRP |
| maps_to_bcom_mealplan | MPT |
| notes | HAC & RMA |
| ota_description | PCT |
| percent_after_deadline | BCCP |
| percent_after_reservation | BCCP |
| policy_type | FTT |
| value_type | RMA |


### Errors/Warnings

Requesting unknown **codegroup** information will generate errors:


```xml
<codegroups error="Invalid parameters: invalid codegroup(s) requested inside 'codegroup' element(s): 'ACDC'"
          type="user">
  <error_data>invalid codegroup(s) requested inside 'codegroup' element(s): 'ACDC'</error_data>
</codegroups>
<!-- RUID: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] -->
```

If an error/warning is encountered, and basic troubleshooting methods has been found ineffective, please provide the error/warning message along with the `RUID` of the response message to your Booking.com support contact.