Policies
Locomote Team avatar
Written by Locomote Team
Updated over a week ago

Policies on the Locomote Corporate Travel Platform are setup at a company level by the company administrator, to ensure that it reflects their own corporate travel policy.

When talking about policies on the platform, generally this is around rules in how a traveller (or travel arranger) can book their desired flights, accommodation or transport whilst adhering to the rules set by the company.

For example, this may be a restriction on which airlines are displayed when searching (ie. if a company has a preferred airline) or maybe only economy seats are allowed. Alternatively to help cap a traveller/arranger's budget, Policy could outline that there is a set amount per room, per night allowed when searching for and booking accommodation.

When setting up policy for the Locomote platform, this is done via Travelport's uPolicy tool which then links back into the platform via a unique number that is called Policy ID or Code.

Using the API, we can retrieve a list of policies setup for the company via the GET function. We can also create (POST) without requiring a specific code. Using the "find all" function (GET) we can identify a specific policy code and either update (PATCH) or remove (DELETE). When specifying a relationship to Policies, PATCH & DELETE options are available for the relationship. And just in case we mistakenly delete the record, we can get it back using a different URL to restore (POST).

Secured by auth_token.

Authorisation via "X-USER-USERNAME" and "X-USER-TOKEN"

All Policies

Get Policies

Get a list of policies resources

GET https://locomotetmp.com/api/policies

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XGET https\://[your subdomain].locomotetmp.com/api/policies/
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": [ { "id": "100543", "type": "policies", "attributes": { "code": "100543", "name": "General Policy" } } ],

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

Read only

code

Identifier of the Policy

Read only

name

Name of the Policy

Read only

Create Policies

Create a new policies resource

POST https://locomotetmp.com/api/policies

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XPOST https\://[your subdomain].locomotetmp.com/api/policies/
{ "data": { "type": "policies", "attributes": { "code": "100111", "name": "Hotel Policy" } } }

Example Response

Status code 201 - Created

{ "data": { "id": "100111", "type": "policies", "attributes": { "code": "100111", "name": "Hotel Policy" } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

policies

code*

Identifier of the Policy

Character length: <= 50
Valid characters: A-z 0-9

name*

Name of the Policy

Character length: <= 50
Valid characters: A-z 0-9
%&'()[]*,-./\:_ and whitespace

Remember

You don't need the resource id as the system will assign code as the unique identifier record.

Single Policies

Get a Policy

Get a single "policies" resource

GET https://locomotetmp.com/api/policies{code}

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XGET https\://[your subdomain].locomotetmp.com/api/policies/{code}
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": [ { "id": "100543", "type": "policies", "attributes": { "code": "100543", "name": "General Policy" } } ],

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

Read only

code

Identifier of the Policy

Read only

name

Name of the Policy

Read only

Update a Policy

Update a "policies" resource

PATCH https://locomotetmp.com/api/policies/{code}

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XPATCH https\://[your subdomain].locomotetmp.com/api/policies/{code}
{ "data": { "id": "100111", "type": "policies", "attributes": { "code": "100111", "name": "New Hotel Policy" } } }

Example Response

Status Code: 200 - OK

{ "data": { "id": "100111", "type": "policies", "attributes": { "code": "100111", "name": "New Hotel Policy" } },

Response Fields

Field Name

Description

Valid Values

id*

Identifier used to reference a given record

Read only

type*

Type of resource

policies

code*

Identifier of the Policy

Character length: <= 50
Valid characters: A-z 0-9

name*

Name of the Policy

Character length: <= 50
Valid characters: A-z 0-9
%&'()[]*,-./\:_ and whitespace

Delete a Policy

Delete a "policies" resource

DELETE https://locomotetmp.com/api/policies/{code}

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XDELETE https\://[your subdomain].locomotetmp.com/api/policies/{code}
No request fields required for DELETE

Example Response

Status Code: 204 - No content

No body returned for response

Response Fields

No response fields required as no content is returned after deletion.

Remember

You don't need the resource id or name as the system only needs the type and code to delete the record.

Restore a Policy

Restore a single resource

POST https://locomotetmp.com/api/policies/{code}/actions/restore

Request Parameters

Parameter Name

Description

Required

Valid Values

page[number]

The page number to fetch

No

Any Integer

page[size]

The number of items that appear on each page

No

Any Integer

Example Request

curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XPOST https\://[your subdomain].locomotetmp.com/api/policies/{code}/actions/restore
No request fields required for RESTORE

Example Response

Status Code: 200 - OK

The resource was successfully restored. The updated resource is returned.
{ "data": { "id": "100111", "type": "policies", "attributes": { "code": "100111", "name": "New Hotel Policy" } },

Response Fields

Field Name

Description

Valid Values

type*

Type of resource

policies

code*

Identifier of the Policy

Character length: <= 50
Valid characters: A-z 0-9

Need to Know

*= Denotes mandatory field.

Troubleshooting

If you got a response code other than the code listed in the article, please refer to this page.

Did this answer your question?