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

Preferences refer to certain characteristics a user wants to have in a service to make it preferable to them. In the Locomote Corporate Travel Platform, a user can specify Special Service Requests (SSR) by adding in their preferred meal type, seat type or additional travel requirement ie. Bicycle or Pet in Cargo. These help the airline, hotel or vehicle supplier to cater to these requests to make it a much more enjoyable travel experience.

In Locomote, you have the ability to specify what seat or meal preference you would always like when flying and manage them within the user profile via the Preferences tab. A Preference cannot exist without being associated to a user, as it is profile data.

Seat & Meal Preferences can be managed at a profile level by the Traveller, the assigned Travel Arranger(s) or the Company Administrator.

Using the API, we can retrieve a list of preferences setup for a specific user via the GET function. We can also create (POST) without requiring a specific preference(s) id/code. We can also update (PATCH) or remove (DELETE) the preference. However if we mistakenly delete the record, we are unable to get it back as it will permanently remove the record from the database.

Note

This can only be done where a specific Employee ID is used within the URL. Using any command (GET, POST, PATCH, DELETE) for Preferences is an added function to the Users endpoint.

Secured by auth_token.

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

All Seat Preferences

Get Seat Preferences

Returns a user's seat preference

GET https://locomotetmp.com/api/users/{work_employee_id}/seat_preference

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/users/{work_employee_id}/seat_preference
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": { "id": "2084", "type": "seat_preference", "attributes": { "seat_type": "window" } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

seat_preference

seat_type

Location of seat preference

Window, Aisle, No_Preference

Character length: <=20
Valid characters: A-z "_"

Create Seat Preferences

Create a new seat preference for an user

POST https://locomotetmp.com/api/users/{work_employee_id}/seat_preference

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

Need to Know

You can only create one Seat Preference. If you try to create another preference, it will override the previous preference as this value is a drop-down selection in Locomote.

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/users/{work_employee_id}/seat_preference
{ "data": { "type": "seat_preference", "attributes": { "seat_type": "aisle" }, "relationships": { "user": { "data": { "id": "222444", "type": "users" } } } }}

Example Response

Status code 201 - Created

{ "data": { "id": "2085", "type": "seat_preference", "attributes": { "seat_type": "aisle" } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

seat_preference

seat_type*

Location of seat preference

Window, Aisle, No_Preference

Character length: <=20
Valid characters: A-z "_"

Remember

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

Update a Seat Preference

Update an user's seat preference

PATCH https://locomotetmp.com/api/users/{work_employee_id}/seat_preference

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/users/{work_employee_id}/seat_preference
{ "data": { "type": "seat_preference", "attributes": { "seat_type": "window" }, "relationships": { "user": { "data": { "id": "222444", "type": "users" } } } }}

Example Response

Status Code: 200 - OK

{ "data": { "id": "2085", "type": "seat_preference", "attributes": { "seat_type": "window" } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

seat_preference

seat_type*

Location of seat preference

Window, Aisle, No_Preference

Character length: <=20
Valid characters: A-z "_"

Delete a Seat Preference

Delete an user's seat preference

DELETE https://locomotetmp.com/api/users/{work_employee_id}/seat_preference

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/users/{work_employee_id}/seat_preference
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 any response fields entered (eg. type, code, name) to delete a record. The unique resource id (or {code}) is already identified in the URL, so the API knows which specific record to delete.

Restore a Seat Preference

Unfortunately you cannot restore a preference. Unlike a resource or user where the record is archived, once it has been deleted, it is removed from the database.

All Meal Preferences

Get Meal Preferences

Returns a user's meal preference

GET https://locomotetmp.com/api/users/{work_employee_id}/meal_preference

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/users/{work_employee_id}/meal_preference
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": { "id": "76896720", "type": "meal_preference", "attributes": { "request": "FSML", "comments": null } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

meal_preference

request

The type of meal preference

Character length: 4 (eg. XXYZ)
Valid characters: A-Z

comment

Additional information for the meal_preference

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

Create Meal Preferences

Create a new meal preference for an user

POST https://locomotetmp.com/api/users/{work_employee_id}/meal_preference

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

Need to Know

You can only create one Meal Preference. If you try to create another preference, it will override the previous preference as this value is a drop-down selection in Locomote.

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/users/{work_employee_id}/meal_preference
{ "data": { "type": "meal_preference", "attributes": { "request": "BBML", "comments": "Pescatarian" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } } } }}

Example Response

Status code 201 - Created

{ "data": { "id": "115108860", "type": "meal_preference", "attributes": { "request": "BBML", "comments": null } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

meal_preference

request*

The type of meal preference

Character length: 4 (eg. XXYZ)
Valid characters: A-Z

comment

Additional information for the meal_preference

Character length: <= 10
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.

Update a Meal Preference

Update an user's meal preference

PATCH https://locomotetmp.com/api/users/{work_employee_id}/meal_preference

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/users/{work_employee_id}/meal_preference
{ "data": { "type": "meal_preference", "attributes": { "request": "KSML", "comments": "no" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } } } }}

Example Response

Status Code: 200 - OK

{ "data": { "id": "100959720", "type": "meal_preference", "attributes": { "request": "KSML", "comments": null } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

meal_preference

request*

The type of meal preference

Character length: 4 (eg. XXYZ)
Valid characters: A-Z

comment

Additional information for the meal_preference

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

Delete a Meal Preference

Delete an user's meal preference

DELETE https://locomotetmp.com/api/users/{work_employee_id}/meal_preference

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/users/{work_employee_id}/meal_preference
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 any response fields entered (eg. type, code, name) to delete a record. The unique resource id (or {code}) is already identified in the URL, so the API knows which specific record to delete.

Restore a Meal Preference

Unfortunately you cannot restore a preference. Unlike a resource or user where the record is archived, once it has been deleted, it is removed from the database.

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?