Loyalty Memberships
Locomote Team avatar
Written by Locomote Team
Updated over a week ago

Loyalty Memberships are the reward programs that users can be affiliated to and are available to a range of vendors within the Locomote Corporate Travel Platform. Vendors of air, hotels & car may have a rewards program and within the user's Profile, they can enter and manage their loyalty memberships of those vendors to ensure when creating a trip, they can capture their rewards points.

In Locomote, you have the ability to upload all of your rewards programs and manage them within the user profile via the Loyalty tab. A Loyalty Membership cannot exist without being associated to a user, as it is profile data.

Loyalty Memberships can be uploaded & 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 memberships setup for a specific user via the GET function. We can also create (POST) without requiring a specific membership(s) id/code. Using the "find all" function (GET) we can identify specific membership id(s) and either update (PATCH) or remove (DELETE). However if we mistakenly delete the record, we are unable to get it back as it will permanently remove the record from the database.

Secured by auth_token.

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

All Loyalty Memberships

Get Loyalty Memberships

Returns all "loyalty_memberships" resources belonging to a "users" resource.

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

Need to Know

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

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}/loyalty_memberships
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": [ { "id": "4febbfe5-a4ac-4274-a251-f948d77d91a1", "type": "loyalty_memberships", "attributes": { "account_number": "V0845365", "membership_name": "John Smith", "level": "Gold", "expires_on": "2020-06-30" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b8c96-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } }, { "id": "34af848d-55da-4b45-8ffe-1f5ddfbeee73", "type": "loyalty_memberships", "attributes": { "account_number": "00987622", "membership_name": "John Smith", "level": "Gold", "expires_on": "2022-03-10" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b9246-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } } ],

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

loyalty_memberships

account_number

User's unique loyalty membership document number

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

membership_name

Name of person the membership is assigned to

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

level

The level of membership that is held

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

expires_on

Date of membership expiration

YYYY-MM-DD

id

Identifier used to reference the user's unique work_employee_id

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

type

Type of resource (the relationship is linked to)

user

id

Identifier used to reference the unique Loyalty Provider record

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

type

Type of resource (the relationship is linked to)

loyalty_providers

Create Loyalty Memberships

Create a new loyalty_memberships resource

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

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

To create a Loyalty Membership, we need to know the loyalty_provider id. To find this, refer to Loyalty Providers.

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}/loyalty_memberships
 { "data": { "type": "loyalty_memberships", "attributes": { "account_number": "H66590214", "membership_name": "John Smith", "level": "Gold", "expires_on": "2021-01-01" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b90ff-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } }}

Example Response

Status code 201 - Created

{ "data": { "id": "ceb2c97e-a060-4c09-bbe5-4b17a6d4654a", "type": "loyalty_memberships", "attributes": { "account_number": "H66590214", "membership_name": "John Smith", "level": "Gold", "expires_on": "2021-01-01" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b90ff-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type*

Type of resource

loyalty_memberships

account_number*

User's unique loyalty membership document number

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

membership_name*

Name of person the membership is assigned to

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

level

The level of membership that is held

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

expires_on*

Date of membership expiration

YYYY-MM-DD

id*

Identifier used to reference the user's unique work_employee_id

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

type*

Type of resource (the relationship is linked to)

user

id*

Identifier used to reference the unique Loyalty Provider record

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

type*

Type of resource (the relationship is linked to)

loyalty_providers

Remember

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

Single Loyalty Memberships

Get a Loyalty Membership

Get a single "loyalty_memberships" resource

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

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

In order for us to PATCH or DELETE a Loyalty Membership, we need to now specify the loyalty_membership ID in the URL to ensure we isolate the correct loyalty membership.

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}/loyalty_memberships{id}
No request fields required for GET

Example Response

Status Code: 200 - OK

{ "data": { "id": "34af848d-55da-4b45-8ffe-1f5ddfbeee73", "type": "loyalty_memberships", "attributes": { "account_number": "00987622", "membership_name": "John Smith", "level": "Gold", "expires_on": "2022-03-10" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b9246-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } },

Response Fields

Field Name

Description

Valid Values

id

Identifier used to reference a given record

Read only

type

Type of resource

loyalty_memberships

account_number

User's unique loyalty membership document number

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

membership_name

Name of person the membership is assigned to

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

level

The level of membership that is held

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

expires_on

Date of membership expiration

YYYY-MM-DD

id

Identifier used to reference the user's unique work_employee_id

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

type

Type of resource (the relationship is linked to)

user

id

Identifier used to reference the unique Loyalty Provider record

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

type

Type of resource (the relationship is linked to)

loyalty_providers

Update a Loyalty Membership

Update a "loyalty_memberships" resource

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

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}/loyalty_memberships{id}
{ "data": { "id": "ceb2c97e-a060-4c09-bbe5-4b17a6d4654a", "type": "loyalty_memberships", "attributes": { "account_number": "H66590214", "membership_name": "John Smith", "level": "Gold", "expires_on": "2021-01-01" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b9176-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } }}

Example Response

Status Code: 200 - OK

{ "data": { "id": "ceb2c97e-a060-4c09-bbe5-4b17a6d4654a", "type": "loyalty_memberships", "attributes": { "account_number": "H66590214", "membership_name": "John Smith", "level": "Gold", "expires_on": "2021-01-01" }, "relationships": { "user": { "data": { "id": "098765", "type": "users" } }, "loyalty_provider": { "data": { "id": "9c5b9176-2cce-11e8-87f9-0662bed6e7db", "type": "loyalty_providers" } } } },

Response Fields

Field Name

Description

Valid Values

id*

Identifier used to reference a given record

Read only

type*

Type of resource

loyalty_memberships

account_number*

User's unique loyalty membership document number

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

membership_name*

Name of person the membership is assigned to

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

level

The level of membership that is held

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

expires_on*

Date of membership expiration

YYYY-MM-DD

id*

Identifier used to reference the user's unique work_employee_id

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

type*

Type of resource (the relationship is linked to)

user

id*

Identifier used to reference the unique Loyalty Provider record

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

type*

Type of resource (the relationship is linked to)

loyalty_providers

Delete a Loyalty Membership

Delete a "loyalty_memberships" resource

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

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}/loyalty_memberships{id}
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 Loyalty Membership

Unfortunately you cannot restore a membership. 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?