Table of Contents
- Prerequisite before starting
- Prerequisite authentication
- Order Tracking API URL
- Get all my orders
- Filter the orders list
- Pagination of the orders list
- Get details of an order
- Error handling
Prerequisite before started
- For this "Getting started", we will use the command-line tool Curl.
- The API requires the generation of an API-Key.
- Your Orange Business Services representative will provide you this API key
- The API key must be added to HTTP headers of each API call.
- The header is
X-Api-Key
. - The API requires also the generation of an API-Key. API-Key expires after 2 years and must be renewed by asking to Orange Support.
Prerequisite authentication
Access to this API is secured by the OAuth 2.0 framework with the Client Credentials grant type, which means that you will have to present an OAuth 2.0 access_token whenever you want to request this API.
It's easy to negotiate this access_token: just send a request to the proper token negotiation endpoint, with a Basic Authentication header valued with your own client_id and client_secret.
For this API, the token negotiation endpoint is:
https://api.orange.com/oauth/v3/token
A technical guide is available to learn how to negotiate and manage these access_token
.
Order Tracking API URL
https://api.orange.com/order-tracking/b2b/v1/
Get all my orders
List all my orders without filter, sort or paging
Request
- Method & URL : GET , https://api.orange.com/order-tracking/b2b/v1/orders
- Authorization : OAuth 2.0 authentication to get the access token (see "Prerequisite before starting" section)
- Header : add x-api-key => Value provided by your administrator
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/order-tracking/b2b/v1/orders?status=Current
Response
Header
you will receive 3 specific headers:
- HTTP/1.1 200 OK for a successful answer
- X-Result-Count , the number of orders
- X-Total-Count , the number of all orders matching criteria.
HTTP/1.1 200 OK
X-Result-Count: 106
X-Total-Count: 25
Body
List of orders in a json format
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
[
{
"id": "123456",
"request": {
"id": "3-0000000",
"customerReference": "",
"status": "",
"orangeContact": {
"name": "",
...
]
Filter the orders list
You have the possibility to filter a collection by adding to the URI some attributes.
Example : retrieve orders with status "Closed".
Request
Add the following parameters to the URL : status=Closed
.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/order-tracking/b2b/v1/orders?status=Closed
Response
- List of your filtered orders in a json format
Pagination of the orders list
The API provides a pagination mechanism with the following query parameters
- offset: The index of the first element to retrieve. Zero is the first item of the collection.
- limit: The maximum number of items to return.
- sort: The comma-separated list of field names to sort the result. Prefixing a field name with a "-" sign will indicate a descending order.
Thanks to these 3 query parameters, you are able to retrieve orders page per page.
Example: to get the next 20 orders from the 10th orders of the global list and ordered by id :
Request
Add the following parameters to the URL :offset=10&limit=20&sort=-id.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/order-tracking/b2b/v1/orders?status=Current&offset=10&limit=20&sort=-id
Response
- List of 20 orders in a json format
Get details of an order
With the Order tracking API, you are able to retrieve all information about a specific order.
You only need the id of the order (you can retreive it from the orders list).
Request
Add the the id of the order (you can retreive it from the orders list) to the URL :/{orderId}.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/order-tracking/b2b/v1/orders/{orderId}
Response
- Your order in a json format
Error handling
Orange APIs use appropriate HTTP status codes to indicate any request processing error. For more details, see Handling API errors.