Table of Contents
- Prerequisite before starting
- Authentication prerequisite
- Get all my Orders
- Filter the orders list
- Pagination of the orders list
- Get details of an order
- Error handling
Prerequisite before starting
- For this "Getting started", we will use the command-line tool Curl.
- The API requires the generation of an API-Key
- Your Orange Business 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.
Authentication prerequisite
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
.
Get all my orders
List all my orders without filter, sort or paging
Request
- Method & URL :
GET
,https://api.orange.com/ordering/b2b/v3/requests
- 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/ordering/b2b/v3/requests
Response
Header
you will receive 3 specific headers:
HTTP/1.1 200 OK
for a successful answerX-Result-Count
, the number of OrdersX-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": "3-00286023",
"customerReference": "#DEMO#",
"step": "REQUEST",
"priority": "MEDIUM",
"customer": {
"id": "33-01257052",
"name": "demo.gcompte"
},
"comment": "New order",
"category": "R_BVPN_S1A",
...
]
Filter the orders list
You have the possibility to filter a collection by adding to the URI some attributes.
Example to retrieve all my generic orders
Request
- Add the following parameters to the URL :
type=C_GENERIC_S1
.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/ordering/b2b/v3/requests?type=C_GENERIC_S1
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 CIs page per page.
Example: to get the next 20 Orders from the 10th Order of the global list and ordered by the priority:
Request
- Add the following parameters to the URL :
offset=10&limit=20&sort=-createdAt
.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/ordering/b2b/v3/requests?offset=10&limit=20&sort=-createdAt
Response
- List of 20 orders in a json format
Get details of an order
With the Core Information for Business 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 :
/{Order_id}
.
curl -X GET \
-H "Authorization: {access_token}" \
-H "X-API-key: {dev_key}" \
https://api.orange.com/ordering/b2b/v3/requests/{Order_id}
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.