Authentication
OAuth2 access tokens issued with the client credentials grant, an alternative to HTTP Basic authentication for every authenticated operation
Issue an OAuth2 access token
Issues an OAuth2 access token with the client credentials grant (RFC 6749 section 4.4). The credentials are those of the API user: send the user name as client_id and the password as client_secret, either in the form body or in an Authorization: Basic header, but not in both.
The token is valid for one hour: cache it and reuse it until shortly before it expires. A password change invalidates every outstanding token of the user. There are no refresh tokens and tokens cannot be revoked individually.
The successful response follows the OAuth2 format (RFC 6749 section 5.1); errors use the error envelope of the rest of the API.
Request Body schema: application/x-www-form-urlencodedrequired
Token request, form-urlencoded as required by RFC 6749 section 3.2.
| grant_type required | string Must be |
| client_id | string API user name. Omit when the credentials travel in the Authorization header. |
| client_secret | string Password of that API user. Omit when the credentials travel in the Authorization header. |
| scope | string Optional. The authority granted to the token is determined by the roles and licences of the user. |
Responses
200 Token issued
Token issued
Response Schema: application/json
| access_token | string The issued opaque access token. |
| token_type | string Type of the token, always |
| expires_in | integer Lifetime of the token in seconds. |
400 Unsupported grant type (code NOT_VALID_VALUE_FOR_PARAMETER, parameter grant_type), credentials sent both in the header and in the body, or request without HTTPS (code REQUEST_VALUE_NOT_VALID).
Unsupported grant type (code NOT_VALID_VALUE_FOR_PARAMETER, parameter grant_type), credentials sent both in the header and in the body, or request without HTTPS (code REQUEST_VALUE_NOT_VALID).
Response Schema: application/json
| success | boolean Indicates that the operation did not complete successfully. | ||||||||||||||||||||||||||||||||||||||
| httpStatusCode | integer <int32> HTTP status code returned by the operation. | ||||||||||||||||||||||||||||||||||||||
| message | string Human-readable message describing the validation error. | ||||||||||||||||||||||||||||||||||||||
| messageType | string Enum: "Error" "Warning" "Information" Severity classification of the message. | ||||||||||||||||||||||||||||||||||||||
| parameter | string Aggregated list of the | ||||||||||||||||||||||||||||||||||||||
| parameterValue | string Aggregated list of the | ||||||||||||||||||||||||||||||||||||||
| parameterPosition | string Aggregated list of the | ||||||||||||||||||||||||||||||||||||||
| requestGuid | string Unique identifier of the request, returned for tracing purposes. | ||||||||||||||||||||||||||||||||||||||
Array of objects (ApiIssue) Every error that made the request fail, in detection order, each one with its stable code and, when it refers to an element of the request, its parameter, value, position and JSON Pointer. Present on every error response, with at least one entry. | |||||||||||||||||||||||||||||||||||||||
Array [
] | |||||||||||||||||||||||||||||||||||||||
Array of objects (ApiIssue) Every warning found while processing the request, in detection order, each one with its stable code. Omitted when there is no warning. | |||||||||||||||||||||||||||||||||||||||
401 Missing or wrong client credentials (code AUTHENTICATION_FAILED, the same for an unknown user and for a wrong password).
Missing or wrong client credentials (code AUTHENTICATION_FAILED, the same for an unknown user and for a wrong password).
Response Schema: application/json
| success | boolean Indicates that the operation did not complete successfully. |
| httpStatusCode | integer <int32> HTTP status code returned by the operation. |
| message | string Human-readable message describing the authentication error. |
| messageType | string Enum: "Error" "Warning" "Information" Severity classification of the message. |
| parameter | string Aggregated list of the |
| parameterValue | string Aggregated list of the |
| parameterPosition | string Aggregated list of the |
| requestGuid | string Unique identifier of the request, returned for tracing purposes. |
Array of objects (ApiIssue) The authentication error, with its stable code. | |
Array of objects (ApiIssue) Every warning found while processing the request, in detection order, each one with its stable code. Omitted when there is no warning. | |
500 Unexpected Error
Unexpected Error
Response Schema: application/json
| success | boolean Indicates that the operation did not complete successfully. |
| httpStatusCode | integer <int32> HTTP status code returned by the operation. |
| message | string Human-readable message describing the unexpected server error. |
| messageType | string Value: "Error" Severity classification of the message. |
| parameter | string Aggregated list of the |
| parameterValue | string Aggregated list of the |
| parameterPosition | string Aggregated list of the |
| requestGuid | string Unique identifier of the request, returned for tracing purposes. |
Array of objects (ApiIssue) Every error that made the request fail, in detection order, each one with its stable code and, when it refers to an element of the request, its parameter, value, position and JSON Pointer. Present on every error response, with at least one entry. | |
Array of objects (ApiIssue) Every warning found while processing the request, in detection order, each one with its stable code. Omitted when there is no warning. | |
post/oauth2/token
Response samples
{- "access_token": "string",
- "token_type": "bearer",
- "expires_in": 3599
}{- "success": false,
- "httpStatusCode": 400,
- "message": "Good not valid",
- "messageType": "Error",
- "parameter": "goods",
- "parameterValue": "GoodX",
- "parameterPosition": "3",
- "requestGuid": "F8AEC2D1-9515-4013-AA46-10405EB688A2",
"errors": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
],"warnings": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
]
}{- "success": false,
- "httpStatusCode": 401,
- "message": "Authentication failed: the credentials of the API user or the access token are not valid",
- "messageType": "Error",
- "parameter": "Authorization",
- "parameterValue": "Value ABC",
- "parameterPosition": "3",
- "requestGuid": "F8AEC2D1-9515-4013-AA46-10405EB688A2",
"errors": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
],"warnings": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
]
}{- "success": false,
- "httpStatusCode": 500,
- "message": "Unexpected Error",
- "messageType": "Error",
- "parameter": "string",
- "parameterValue": "string",
- "parameterPosition": "string",
- "requestGuid": "F8AEC2D1-9515-4013-AA46-10405EB688A2",
"errors": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
],"warnings": [
{
- "code": "NOT_VALID_VALUE_FOR_PARAMETER",
- "message": "Not valid value for the parameter.",
- "parameter": "onTheFlySimpleProducts.packageId",
- "parameterValue": "48213",
- "parameterPosition": "2",
- "pointer": "/overpacks/0/onTheFlySimpleProducts/2/packageId",
- "ruleReference": "IMDG 4.1.4.1 P001",
"segregation": {
- "leftConsignmentId": 48213,
- "leftConsignmentItemCode": "ITEM-9515-4013-AA46",
- "leftTransportEquipmentId": 1207,
- "rightConsignmentId": 48214,
- "rightConsignmentItemCode": "ITEM-9515-4013-AA46",
- "rightTransportEquipmentId": 1208,
- "ruleReference": "IMDG 7.2.4; IMDG 7.3.4.1",
- "requiredSeparation": "NotRequired",
- "verdict": "Allowed",
- "remarks": "Keep one container space between both containers."
}
}
]
}