Response body

All responses by the Flex.API have three top-level elements, status, data, and errors.

Example response of a successful query in JSON:

Response Body
{
"status": "ok",
"data": {
"hash": "...",
"iframe_url": "..."
},
"errors": null
}

The response status indicates whether the request was processed or not. There are three different options:

Status

Description

ok

The request to the flex.API was successful and the desired action was performed. The field data contains the details.

error

The requested action could not be performed, due to a technical error. Such errors indicate defects of the Flex.API or the client. The attention of a developer is required. You find details in the field error.

failed

The desired action could not be performed. These are mostly validation errors, so the user should check the error messages. Again you find details in the field error.

The structure of the data field depends on the particular API endpoint.

Example response of a failed query:

Response Body
{
"status": "failed",
"data": null,
"errors": [
{
"code": "0001",
"message": "Invalid apikey"
}
]
}

If present, the errors field is an array with pairs of code and message.

Attribute

Type

Description

code

string

Machine-readable error code. See section Error Codes.

message

string

Human-readable error message. It is translated according to the Accept-Language setting in the request. See the section Content Negotiation Headers for more details.

Usually there is only one error reported. But your application should be prepared to process multiple messages.