TYRIOS order API
Beschreibung:
TYRIOS makes it possible to manage orders directly from API. Here are general rules for using the order API:
- TYRIOS depends on different module configurations. It depends on your configuration if an endpoint is available.
- It depends on your rights if you can call a specific endpoint.
- TYRIOS is an aspect oriented system. It depends on the concrete configuration, which fields are available and processes. In this document we will discuss the typical structure.
Authentication
The API endpoints of TYRIOS are only available for authorized users. Therefore, the user must be authenticated. There are two different authentication types:
- Authentication by BASIC authentication. The user account must have an activated REST API token. You need to send an appropriate BASIC authentication header.
- Authentication by mobile app registration. You need to send an appropriate app registration token.
Data structure
TYRIOS makes the underlying data structure directly available using REST API.
- OrderData: saves the order itself (data type OrderData)
- UserData: saves the user information - potentially linked with customer information (data type UserData)
- BillingAddress and ShippingAddress: saves addresses (data type UserAddressData)
- OrderDetailData: saves different order positions (data type OrderDetailData)
- OrderDetailDataSubPosition: saves sub positions (data type OrderDetailDataSubPosition)
- ProductData: saves product information, typically linked to the PIM system (data type ProductData)
API endpoints
Get orders
To get all available orders, you need to make a GET request to the following URL:
https://[tyrios-instance.de]/service/OrderManagement/OrderData/
The service provides a paginated result. You can control the pagination with offset and length parameter. In addition, the service supports sorting and filtering. As filter, a JSON struct is required. All order fields are supported.
Sorting supports sorting for multiple fields and need to be provided as JSON struct.
Get a specific order data
To get one specific order data, you need to create a GET request to following URL.
https://[tyrios-instance.de]/service/OrderManagement/OrderData/[orderID]
Please keep in mind that the concrete data structure depends on your installation.
Save / create order
To create or save an order, you need to create a POST request to following URL.
https://[tyrios-instance.de]/service/OrderManagement/OrderData/
You can create an empty order by passing an empty JSON object. By doing this, the system automatically creates an order ID for which you can add / update order details in an iterative process.
You can also assign data directly to the order - including creating the complete order data object. This data must be provided as payload to the POST request.
{
UserData: null, // UserData object or userID
BillingAddress: null, //UserAddressData object or addressID
ShippingAddress: null, // UserAddressData object or addressID
...
}
Please have a look to the detailed OrderData data structure to see the possible fields.
Note
The API depends on your specific user rights. This not only applies to the API endpoints itself but also to the underlying functionality. If you don't have the right to change an order state, the order state will be for example not processed with this API call. Your provided field data will be ignored in that case.
Add / update an order detail data
if you want to add an order detail data to an order, you need to create a POST request to following URL:
https://[tyrios-instance.de]/service/OrderManagement/OrderData/[orderID]/OrderDetailData
If you want to assign a product, you need to specify in the payload a ProductData object or the corresponding product ID. TYRIOS will automatically load the corresponding ProductData from the pim system and create the corresponding OrderDetailData. You can however also overwrite this data. The payload will look like:
{
ProductData: null // ProductData object / productID
amount: 23, //required, automatically set to 1 if ProductData is given
title: "title", //required, automatically set if ProductData is given
"materialNumber": "materialNumber", // automatically set if ProductData is given
"price": 14.33 //required, automatically set if ProductData is given
"tax": 19, // required, automatically set if ProductData is given
description: //optional, automatically set if ProductData is given
}
Please keep in mind that the concrete data structure depends on your installation. If OrderDetailData->id is null, ProductData is automatically converted to OrderDetailData. Only this data is overwritten, which is specified.
Delete an order detail data
To delete an OrderDetailData, you need to send a DELETE request to the URL:
https://[tyrios-instance.de]/service/OrderManagement/OrderData/[orderID]/OrderDetailData/["OrderDetailDataID"]
Release an order data
By default, an OrderData is created with primary state "Draft". An order in draft state can be changed by the user and is not released so far. Typically, a user has the right to release an OrderData in an online shop. This is also possible to be done by API. Therefore a POST request must be sent to this endpoint:
https://[tyrios-instance.de]/service/OrderManagement/OrderData/[orderID]/release
No payload is required.
The API is only available, ...
- if the currently logged-in user is the user of the OrderData itself or
- if your authorized user has the right to change order states or
- if the Cookie OrderCode is available and it is identical to cookieID field of OrderData
- if an HTTP header Order-Code is available and it is identical to cookieID field of OrderData
By default, releasing an order automatically sends order state mails according to the system definition. It is however possible to tell the system that there should be no notification mail. This makes sense if the notification is done by an external system. To prevent the notification, you need to send following payload:
{ "disableStateMail":true }