Retrieve order data
from TB.One to your system
Definition
After sales are generated within your TB.One account – they may be from a channel like Amazon, Real, About You, Zalando or from your own custom channel – you might want to retrieve these orders from the REST API to import them into your own system.
TB.One uses a specific XML format that we call “TB.Order“ for order transmission. The same format is used no matter if you are sending to or retrieving from TB´s REST API. This format includes all relevant order data like
- the point of sale /channel information (where did the order occur)
- customer’s billing address
- customer’s shipping address (can be identical with billing address)
- ordered articles and services
Preconditions
- You will need TB.One REST API credentials.
- Of course there need to be unprocessed orders in your TB.One account available. If there aren’t any, you can manually create a test order in your TB.One interface.
Process
- GET open orders from our REST API endpoint https://rest.trade-server.net/(HNR)/orders/[&channel=(CHID)]
You will find all open orders within one XML. Iterate through the order list and write every order to your database. - For each successfully handled order you need to send a confirmation call to mark the order as exported.
This is just a simple POST call to https://rest.trade-server.net/(HNR)/orders/(ORDID)/exported?. - When you post that REST call, TB.One will answer with a HTTP Status code. 200 is good, everything else needs to be taken care of by you. The available status codes can be viewed in API documentation.
- When your orders are executed you can download corresponding pdf documents (invoice, ship label, delivery note) in pdf format via the REST API endpoint
https://rest.trade-server.net/(HNR)/orders/(orderId)/(filetype). The files can be downloaded manually or processed by your system automatically. Developer information can be found in the API reference.
Best Practise
- For testing purposes either get a separate TB.One account, or you can manually create a test order within your TB.One interface.
- Usually all orders from channels like Amazon or Rakuten within TB.One are considered “paid” and ready to ship.
- Always handle the response status code when you send requests to our API.
- Selling on international channels? The order XML will be in the channels language. I.e. article titles are in the associated language. If you want to identify the used language you need to map the channel ID to channels language on your side.