Welcome to the Apilo Help Center.
[API] Orders – downloading list, details. Creating orders
Contents
Endpoint
To perform actions on orders, use the endpoint
GET /rest/api/orders/
Retrieving the list of orders
It is recommended to use the filter orderedAfter and isOrderDocument when retrieving the list of orders.
The orderedAfter filter allows you to limit the results to orders placed after a specified date, which can significantly improve the performance and response speed of the API.
The isOrderDocument filter enables filtering of orders that have a sales document, which is useful in the context of specific operations on those documents.
Example:
GET /rest/api/orders/?isOrderDocument=1&orderedAfter=2024-01-01T19%3A55%3A12%2B01%3A00
Downloading Order Details
To obtain order details, use the get_rest_order_documents_detail endpoint.
Make sure you provide the appropriate order identifiers to receive complete and accurate information about the specific order.
Basic order information can also be obtained by providing the id in the filters for the GET /rest/api/orders/ endpoint.
To display order details, please use the GET /rest/api/orders/{id}/ endpoint.
Example:
JSONGET /rest/api/orders/?id=MA240100001r GET /rest/api/orders/MA240100001
Creating a New Order
To create an order, use the POST /rest/api/orders endpoint. During the order creation, there is an option to provide an order number from an external system. It is important to mention that this number will be visible in related documents, which will facilitate tracking and managing orders in the future.
Example:
POST /rest/api/orders + JSON RequestBody
Updating Order List
After creating a new order using the “`POST /rest/api/orders/“` endpoint, it is necessary to update the order list to reflect changes and avoid duplicates. Here are the steps to take:
-
Fetch the current order list:
Use the endpoint
GET /rest/api/orders/ with the appropriate filters such as orderedAfter and isOrderDocument to retrieve the latest order list.Example query: http
GET /rest/api/orders?orderedAfter=2024-09-01T00:00:00Z&isOrderDocument=true -
Checking the newly created order:
After creating the order using POST /rest/api/orders/, the order number in the integrator’s system should be visible in the response.
Example query: JSON
POST /rest/api/orders/?id=MA240100001 Content-Type: application/json { "orders": [ { "idExternal": "123321123", "isInvoice": false, "originalCurrency": "CZK", "isEncrypted": false, "createdAt": "2024-01-31T10:05:07+0100", "updatedAt": "2024-06-17T10:07:23+0200", "orderItems": [ { "id": 16, "idExternal": null, "ean": "978020137962", "sku": "123213", "originalName": "test product", "originalCode": null, "originalPriceWithTax": "123.00", "originalPriceWithoutTax": "100.00", "media": null, "quantity": 1, "tax": "23.00", "status": 1, "unit": "t", "type": 1 }, { "id": 17, "idExternal": null, "ean": null, "sku": null, "originalName": "ManualCarrier", "originalCode": "1", "originalPriceWithTax": "0.00", "originalPriceWithoutTax": "0.00", "media": null, "quantity": 1, "tax": null, "status": 1, "unit": null, "type": 2 } ], "addressCustomer": { "name": "te", "phone": "13123123", "email": "t@t.com", "id": 41, "streetName": null, "streetNumber": null, "city": null, "zipCode": null, "country": null, "department": null, "class": "customer" }, "isCanceledByBuyer": null, "id": "MA240100001","status": 5} ], "totalCount": 1, "currentOffset": 0, "pageResultCount": 1 } -
Updating the local order list
After receiving the response with the order number, update the local order list to include the new order.
Example response: JSON
GET /rest/api/orders/?id=MA240100001 { "orders": [ { "idExternal": "123321123", "isInvoice": false, "originalCurrency": "CZK", "isEncrypted": false, "createdAt": "2024-01-31T10:05:07+0100", "updatedAt": "2024-06-17T10:07:23+0200", "orderItems": [ { "id": 16, "idExternal": null, "ean": "978020137962", "sku": "123213", "originalName": "test product", "originalCode": null,"originalPriceWithTax": "123.00", "originalPriceWithoutTax": "100.00", "media": null, "quantity": 1, "tax": "23.00", "status": 1, "unit": "t", "type": 1},{ "id": 17, "idExternal": null, "ean": null, "sku": null, "originalName": "ManualCarrier", "originalCode": "1", "originalPriceWithTax": "0.00", "originalPriceWithoutTax": "0.00", "media": null, "quantity": 1, "tax": null, "status": 1, "unit": null, "type": 2 } ], "addressCustomer": { "name": "te", "phone": "13123123", "email": "t@t.com", "id": 41, "streetName": null, "streetNumber": null, "city": null, "zipCode": null, "country": null, "department": null, "class": "customer" }, "isCanceledByBuyer": null, "id": "MA240100001", "status": 5 } ], "totalCount": 1, "currentOffset": 0, "pageResultCount": 1 } -
Exclusion of the new order from subsequent queries:
During subsequent queries to the endpoint GET /rest/api/orders, make sure that the new order is not already included in the results. This can be achieved through appropriate filtering, e.g., using orderedAfter with the creation date of the new order.
Example query: JSON
GET /rest/api/orders?orderedAfter=2024-09-05T10:00:00Z&isOrderDocument=1
List of orders with item limit
It is recommended to use the limit filter when retrieving the list of orders. The filter allows limiting the display of results for orders that have a large number of products or related documents.
