Migrate to V2 API¶
New APIs are being created to enable a unified management of your copper and fibre products. These v2 APIs replace the now deprecated v1 APIs.
Below you will find a correspondence table to better understand the changes to be made.
On Sandbox and Production environments¶
V1 |
V2 |
---|---|
api/orders/ |
api/v2/orders/ |
api/fiber-orders/ |
api/v2/orders/ |
api/services/ |
api/v2/services/ |
api/fiber-services/ |
api/v2/services/ |
api/actions/ |
api/v2/services/{service_uuid}/actions/ |
api/appointment/ |
api/v2/orders/{order_uuid}/appointment/ |
api/appointment/ |
api/v2/appointment/slots/ |
JWT v2 Authentication¶
Authentication to the v2 APIs is now performed using JWT (JSON Web Token) tokens. Here is how to obtain and use these tokens with the new URLs:
Obtain an access token (login)¶
Send a POST request to the following URL:
POST /api/v2/account/token/
With the following JSON body:
{
"email": "your_email@example.com",
"password": "your_password"
}
If successful, the response will contain:
{
"refresh": "<refresh_token>",
"access": "<access_token>",
"token": "<access_token>"
}
The access
(or token
) field must be used in the Authorization header of your API requests:
Authorization: Bearer <access_token>
Verify a token¶
To check the validity of a JWT token:
POST /api/v2/account/token/verify/
With the body:
{
"token": "<access_token>"
}
Refresh a token¶
To obtain a new access token from a refresh token:
POST /api/v2/account/token/refresh/
With the body:
{
"refresh": "<refresh_token>"
}
The response will contain a new access_token
.
Summary of JWT v2 endpoints¶
Action |
URL |
---|---|
Obtain an access token |
/api/v2/account/token/ |
Verify a token |
/api/v2/account/token/verify/ |
Refresh a token |
/api/v2/account/token/refresh/ |