Offices (or Faculty) can be setup at a company level by the company administrator, to ensure that reflects their own company or conglomerate configuration of subsidiary companies or locations. The Locomote Corporate Travel Platform provides the flexibility to either utilise Offices to it's full extent or use the minimum with one single 'office.'
For example, Walt Disney owns Marvel as well as Lucas Films. If Walt Disney was to use the Locomote platform and there's an office for Marvel in New York & an office for Lucas Films in Los Angeles, these could be entered into the platform so that travellers, arrangers & authorisers working for those companies could be allocated to their relevant offices/faculty locales.
Using the API, we can retrieve a list of offices 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 office code and either update (PATCH) or remove (DELETE). When specifying a relationship to Offices, 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).
Authorisation via "X-USER-USERNAME" and "X-USER-TOKEN"
All Offices
Get Offices
Get a list of offices resources
GET https://locomotetmp.com/api/offices
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/offices/
No request fields required for GET
Example Response
Status Code: 200 - OK
{
"data": [
{
"id": "MEL",
"type": "offices",
"attributes": {
"code": "MEL",
"name": "Melbourne"
}
}
],
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id |
Identifier used to reference a given record | Read only |
type |
Type of resource | offices |
code |
Identifier of the Office | Character length: <= 50 Valid characters: A-z 0-9 %&'()[]*,-./\:_ and whitespace |
name |
Name of the Office | Character length: <= 50 Valid characters: A-z 0-9 %&'()[]*,-./\:_ and whitespace |
Create Offices
Create a new offices resource
POST https://locomotetmp.com/api/offices
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/offices/
{
"data": {
"type": "offices",
"attributes": {
"code": "SYD",
"name": "Sydney"
}
}
}
Example Response
Status code 201 - Created
{
"data": {
"id": "SYD",
"type": "offices",
"attributes": {
"code": "SYD",
"name": "Sydney"
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id* |
Identifier used to reference a given record | Read only |
type* |
Type of resource | offices |
code* |
Identifier of the Office | Character length: <= 50 Valid characters: A-z 0-9 |
name* |
Name of the Office | 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 Offices
Get an Office
Get a single "offices" resource
GET https://locomotetmp.com/api/offices{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/offices/{code}
No request fields required for GET
Example Response
Status Code: 200 - OK
{
"data": {
"id": "MEL",
"type": "offices",
"attributes": {
"code": "MEL",
"name": "Melbourne"
}
},
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 Office | Read only |
name |
Name of the Office | Read only |
Update an Office
Update an "offices" resource
PATCH https://locomotetmp.com/api/offices/{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/offices/{code}
{
"data": {
"id": "MEL",
"type": "offices",
"attributes": {
"code": "MEL",
"name": "Melbourne CBD"
}
}
}
Example Response
Status Code: 200 - OK
{
"data": {
"id": "MEL",
"type": "offices",
"attributes": {
"code": "MEL",
"name": "Melbourne CBD"
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id* |
Identifier used to reference a given record | Read only |
type* |
Type of resource | offices |
code* |
Identifier of the Office | Character length: <= 50 Valid characters: A-z 0-9 |
name* |
Name of the Office | Character length: <= 50 Valid characters: A-z 0-9 %&'()[]*,-./\:_ and whitespace |
Delete an Office
Delete an "offices" resource
DELETE https://locomotetmp.com/api/offices/{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/offices/{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 an Office
Restore a single resource
POST https://locomotetmp.com/api/offices/{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/offices/{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": "SYD",
"type": "offices",
"attributes": {
"code": "SYD",
"name": "Sydney"
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
type* |
Type of resource | offices |
code* |
Identifier of the Office | 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.
Comments
Article is closed for comments.