Account Assignments API v2.1

The Account Assignments API lets you list all hotels in the specified account or sub account, and, optionally, its sub accounts. You can also move (or re-assign) hotels from one account or sub account to another.

Paths

GET base_path/api_version/account_id/assignments
PUT base_path/api_version/account_id/assignments/destination_account_id

Where:

Path Parameter Description
base_path https://www.googleapis.com/travelpartner
api_version v2.1
account_id A parent account or sub account ID. When re-assigning hotels with a PUT request, this account must be a common ancestor of the hotels' accounts as well as the destination account.
destination_account_id The account to which hotels are reassigned in a PUT request.

Query String Parameters

Parameter Description
include_subaccounts Set to "true" to get a list of all hotels in the specified account and all of its sub accounts. This action is recursive. The default value is "false".
include_names Set to "true" to include both the hotel ID and its name in the response. The default value is "false".

Supported Methods

HTTP Method Description
GET Gets a list of hotels in an account or sub account. This action can optionally include sub accounts and the descendents of those sub accounts to return a complete list of hotels in all accounts under the main account.
PUT Moves (or re-assigns) hotels to a single destination account (destination_account_id).

Examples

Lists hotels in account 4200042:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments

Lists hotels in account 4200042 and its sub acccounts:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments?include_subaccounts=true

Lists hotels in account 4200042, and includes hotel names in the response:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments&include_names=true

Moves hotels from account 4200042 and its sub accounts to a single, destination account (4300043):

PUT https://www.googleapis.com/travelpartner/v2.1/4200042/assignments/4300043

Listing hotels in an account

You can use the Account Assignments API to list all hotels in the specified account. The account can be the manager account or a sub account.

To list hotels in an account, send a GET request with the following URL syntax:

GET https://www.googleapis.com/travelpartner/v2.1/account_id/assignments

The following example lists hotels in account 4200042:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments

The Account Assignments API sends a response that contains a list of hotels in the hotels object.

The following sample response shows all hotels in the specified account:

{
  "assignments": [
    {
      "account_id": "4200042",
      "hotels": [
        "master1",
        "master2",
        "master3"
      ]
    }
  ],
  "update_version": "42"
}

To include sub accounts' hotels in the response, set the include_subaccounts query string parameter to "true", as the following example shows:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments?include_subaccounts=true

The following sample response shows all hotels in the specified account (4200042), it's sub accounts (10005 and 10006), as well as any hotels in its sub accounts' sub accounts (10006's child 10007):

{
  "assignments": [
    {
      "account_id": "4200042",
      "hotels": [
        "master1",
        "master2",
        "master3"
      ]
    },
    {
      "parent_account_id": "4200042",
      "account_id": "10005",
      "hotels": [
        "sub1_1",
        "sub1_2",
        "sub1_3"
      ]
    },
    {
      "parent_account_id": "4200042",
      "account_id": "10006",
      "hotels": [
        "sub2_1",
        "sub2_2",
        "sub2_3"
      ]
    },
    {
      "parent_account_id": "10006",
      "account_id": "10007",
      "hotels": [
        "sub3_1",
        "sub3_2",
        "sub3_3"
      ]
    }
 ],
 "update_version": "42"
}

By default, the Account Assignments API returns a list of hotel IDs only. You can optionally include the names of the hotels in the response by setting the include_names query string parameter to "true" in the request, as the following example shows:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/assignments?include_names=true

A response that includes hotel names is slightly more complex, pairing each hotel ID with its name in the hotels array, as the following example shows:

{
  "assignments": [
    {
      "account_id": "50001",
      "hotels": [
        {
          "hotel_id": "hotel1",
          "name": "hotel1_name"
        },
        {
          "hotel_id": "hotel2",
          "name": "hotel2_name"
        },
        {
          "hotel_id": "hotel3",
          "name": "hotel3_name"
        }
      ]
    }
  ],
  "update_version": "42"
}

Moving hotels from one account to another

You can use the Account Assignments API to move (or re-assign) hotels from one account to another account. Hotels can only be moved among accounts. You cannot move hotels among campaigns with the Account Assignments API.

All accounts involved in the move must be descendants of account_id. This means that they would all appear in a response to a GET request that sets include_subaccounts=true.

  • From: The accounts that you move hotels from must be children of the account that you specify as the account_id in your path. You can move hotels from the master account, if the master account matches your account_id.
  • To: The account that you move hotels to is specified at the end of the path (as the destination_account_id). This account must also be a child of the account specified with account_id in the path.

The maximum number of hotels that you can update in a single request is 15,000. This is the number of hotels that are specified in the API request, not the total number of hotels affected by the request. For example, you can have more than 15,000 hotels in a group that are affected by the request.

To move hotels to a target account, send a PUT request with the following syntax:

PUT https://www.googleapis.com/travelpartner/v2.1/account_id/assignments/destination_account_id

The following example moves hotels in account 4200042 or its sub accounts to account 8675309:

PUT https://www.googleapis.com/travelpartner/v2.1/4200042/assignments/8675309

The body of the PUT request contains one or more hotel IDs that are to be moved. These hotels can be in any account, as long as you have write permissions for those accounts. You specify these hotels in an array of hotel_ids by using the following syntax:

{
  hotel_ids: [
    "hotel_id_1"[,"hotel_id_2",...]
  ]
}

The following example request body contains three hotels that are to be moved:

{
  hotel_ids: [
    "h1066",
    "h1492",
    "h1789"
  ]
}

In this example, the Account Assignments API moves the specified hotels from whichever accounts they are in (as long as they are descendants of account_id) to account 8675309.

The Account Assignments API does not respond to a successful move request. If the move was unsuccessful, the Account Assignments API returns an error object that describes the error.

Account Assignements API Changes

Changes to v2.1 of the Account Assignments API include the following:

  • The API endpoint has changed from base_path/2.1/... to base_path/v2.1/...

Send feedback about...

Need help? Visit our support page.