Sapiti.net is an API service that allows developers to easily access information from multiple modern ticketing software’s at once. Since this is the very beginning of the project, we are starting with the Belgian software called UTick. Once the project will be running, we will add the support of other software’s. The definition of the API will not change by adding supported ticketing platforms.
According to your usage, our Team will provide 2 different access keys according to your need :
You can request access to Sapiti Api by
https://sapiti.ovh/v1
https://sapiti.net/v1
This simple call return a basic 'pong' response :
{
"success": true,
"response": {
"message": "pong"
},
"environment": "test",
"api_version": 1,
"datetime": "2020-03-04T10:18:58+01:00",
"cached": false,
"status_code": 200,
"language": "fr"
}
The API response to your request has the following structure :
{
"success": true,
"response": {
},
"environment": "test",
"api_version": 1,
"datetime": "2020-03-04T10:18:58+01:00",
"cached": false,
"status_code": 200,
"language": "fr"
}
Parameter | Values | Description |
---|---|---|
success | true / false | has the request been successfully processed |
response | json formatted / null | the content of the response |
environment | test / prod | our current environment |
api_version | 1 | the current version of the API |
datetime | iso 8601 date string | our current server time |
cached | true / false | does the response come from our cache (for efficiency) |
status_code | integer | the response status code |
language | string | the current content language |
The following status codes are return in the response header :
Code | Description |
---|---|
200 | success |
400 | bad request |
401 | unauthorized |
403 | access denied |
404 | ressource not found |
500 | internal error |
In case of error, the response looks like this :
{
"success": false,
"response": null,
"error": {
"code": 1501,
"message": "id not found"
},
"environment": "test",
"api_version": 1,
"datetime": "2020-03-04T11:33:38+01:00",
"cached": false,
"status_code": 404
}
Error code | Description |
---|---|
1000 | method not allowed |
1020 | invalid json syntax |
1050 | A required parameter is missing |
1051 | A parameter is invalid |
1100 | Authentication required |
1101 | Invalid signature |
1501 | Provided id not found |
Every request’s body must contain at least this mandatory information: your public key, the current timestamp and a signature.
Example:
{
"publickey":"27A77FC5-4118-B3F9-ABF9-E1F82932ED6B",
"timestamp":"2020-03-03T15:46:46+01:00",
"signature":"e276b48bc7d899ff17a4e899e71ad16f7e84ec0bd608a6bb5c75c6bab878db9",
"language": "fr"
}
The time stamp (iso 8601 date string) must be within a 30 seconds range according to our server’s clock.
The signature is generated by a hash function on the concatenated public key and time stamp using your private key
PHP implementation:
$timeStamp= date('c');
$stringToEncore=$publicKey.$timeStamp;
$signature = hash_hmac("sha256", $stringToEncore, $privateKey);
The following libraries are currently available
The PHP library is available on Github: https://github.com/mediamorphose/SapitiClient
If you are using composer, just run the following to add the Sapiti API library to your project:
composer require mediamorphosebe/sapiti-client