Orders

Orders are to group together some tasks (waypoints) that need to be completed to full fill the order.

The new version of the API allows to create orders and tasks in one API call. And combines to two objects Order and Task.

Please find the tehnical API specification here for Task and Order.

An example of such a API call to create an order with two tasks (a pickup and a drop off) would look as follows. The pickup task is created with a address and the dropoff task is crated from a coordinate.

💡

If only a coordinate is provided the reverse geocoding will happen on the GSMtasks platform and we will provide an displayable address.

Creating an Order with tasks

HTTP Request

POST https://api.gsmtasks.com/orders/

Request

{
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"reference": "Order #1",
"orderer": {
"name": "Orderer name"
},
"tasks_data": [
{
"category": "pick_up",
"address": {
"raw_address": "381 Queen Street, London, SW85 1GX"
},
"contact": {
"company": "Pickup company name",
"emails": ["info@pickup.com"],
"phones": ["+44 1632 960167", "+44 1632 960374"],
"notes": "Please call before pickup"
},
"description": "Pickup task description"
},
{
"category": "drop_off",
"address": {
"location": {
"type": "Point",
"coordinates": [24.76271, 59.416163]
}
},
"contact": {
"name": "Dropoff contact name",
"emails": ["info@dropoff.com"],
"phones": ["+44 1632 960277"],
"notes": "Please drop at the door"
},
"complete_after": "2022-01-01T14:00:00Z",
"complete_before": "2022-01-01T16:00:00Z",
"description": "Dropoff task description"
}
]
}

Response

{
"id": "58221f9e-96d0-40c9-96ef-1d3cb08525c3",
"url": "https://api.gsmtasks.com/orders/58221f9e-96d0-40c9-96ef-1d3cb08525c3/",
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"external_id": null,
"reference": "Order #1",
"client": "https://api.gsmtasks.com/clients/0a997ba4-2daf-455f-ad0b-9a9cb9ed1943/",
"orderer": {
"name": "Orderer name"
},
"tasks": [
"https://api.gsmtasks.com/tasks/19373b06-911e-4663-96da-2a0d5215c0b3/",
"https://api.gsmtasks.com/tasks/9b33d9d3-80e1-4d97-aaa0-7a55638cae4f/"
],
"assignee": null,
"auto_assign": false,
"created_by": "https://api.gsmtasks.com/users/18fb9d97-824b-4c2a-9b74-764a88a78c96/",
"created_at": "2022-03-01T10:43:03.267621+02:00",
"updated_at": "2022-03-01T10:43:03.267653+02:00"
}

Creating multiple Orders with one API call

💡

This option is efficient way to avoid rate-limit issues. Also please not that using a POST request with external_id values will detect if the Order has already been created and if so then updates the Order which can save even more API calls.

HTTP Request

POST https://api.gsmtasks.com/orders/

Request

[
{
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"reference": "Order #1",
"orderer": {
"name": "Orderer name"
},
"tasks_data": [
{
"category": "drop_off",
"address": {
"location": {
"type": "Point",
"coordinates": [24.76271, 59.416163]
}
},
"contact": {
"name": "Dropoff contact name",
"emails": ["info@dropoff.com"],
"phones": ["+44 1632 960277"],
"notes": "Please drop at the door"
},
"complete_after": "2022-01-01T14:00:00Z",
"complete_before": "2022-01-01T16:00:00Z",
"description": "Dropoff task description"
}
]
},
{
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"reference": "Order #1",
"orderer": {
"name": "Orderer name"
},
"tasks_data": [
{
"category": "drop_off",
"address": {
"location": {
"type": "Point",
"coordinates": [24.76271, 59.416163]
}
},
"contact": {
"name": "Dropoff contact name",
"emails": ["info@dropoff.com"],
"phones": ["+44 1632 960277"],
"notes": "Please drop at the door"
},
"complete_after": "2022-01-01T14:00:00Z",
"complete_before": "2022-01-01T16:00:00Z",
"description": "Dropoff task description"
}
]
}
]

Response

[
{
"id": "58221f9e-96d0-40c9-96ef-1d3cb08525c3",
"url": "https://api.gsmtasks.com/orders/58221f9e-96d0-40c9-96ef-1d3cb08525c3/",
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"external_id": null,
"reference": "Order #1",
"client": "https://api.gsmtasks.com/clients/0a997ba4-2daf-455f-ad0b-9a9cb9ed1943/",
"orderer": {
"name": "Orderer name"
},
"tasks": [
"https://api.gsmtasks.com/tasks/19373b06-911e-4663-96da-2a0d5215c0b3/",
"https://api.gsmtasks.com/tasks/9b33d9d3-80e1-4d97-aaa0-7a55638cae4f/"
],
"assignee": null,
"auto_assign": false,
"created_by": "https://api.gsmtasks.com/users/18fb9d97-824b-4c2a-9b74-764a88a78c96/",
"created_at": "2022-03-01T10:43:03.267621+02:00",
"updated_at": "2022-03-01T10:43:03.267653+02:00"
},
{
"id": "58221f9e-96d0-40c9-96ef-1d3cb08525c3",
"url": "https://api.gsmtasks.com/orders/58221f9e-96d0-40c9-96ef-1d3cb08525c3/",
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16336/",
"external_id": null,
"reference": "Order #1",
"client": "https://api.gsmtasks.com/clients/0a997ba4-2daf-455f-ad0b-9a9cb9ed1943/",
"orderer": {
"name": "Orderer name"
},
"tasks": [
"https://api.gsmtasks.com/tasks/19373b06-911e-4663-96da-2a0d5215c0b3/",
"https://api.gsmtasks.com/tasks/9b33d9d3-80e1-4d97-aaa0-7a55638cae4f/"
],
"assignee": null,
"auto_assign": false,
"created_by": "https://api.gsmtasks.com/users/18fb9d97-824b-4c2a-9b74-764a88a78c96/",
"created_at": "2022-03-01T10:43:03.267621+02:00",
"updated_at": "2022-03-01T10:43:03.267653+02:00"
}
]