Stores
List stores
The stores of the company. This is where you find the name and address behind a store_id seen in a document or in a stock. A client restricted to some stores only sees those.
Endpoints#
List: GET/api/v1/stores One record: GET/api/v1/stores/{id}
Example request#
List with a page size and a sort:
curl "https://votre-entreprise.evyooht.com/api/v1/stores?per_page=5&sort=-name" \
-H "Authorization: Bearer evy_at_votre_jeton"$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/stores?per_page=5&sort=-name" -Headers $headersconst response = await fetch("https://votre-entreprise.evyooht.com/api/v1/stores?per_page=5&sort=-name", {
headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/stores?per_page=5&sort=-name");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);import requests
response = requests.get(
"https://votre-entreprise.evyooht.com/api/v1/stores",
params={"per_page": 5, "sort": "-name"},
headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())One record by its identifier:
curl "https://votre-entreprise.evyooht.com/api/v1/stores/1" \
-H "Authorization: Bearer evy_at_votre_jeton"$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/stores/1" -Headers $headersconst response = await fetch("https://votre-entreprise.evyooht.com/api/v1/stores/1", {
headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/stores/1");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);import requests
response = requests.get(
"https://votre-entreprise.evyooht.com/api/v1/stores/1",
headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())Query parameters of the list#
All filters can be combined: they add up (AND). An unknown parameter or an invalid value is refused with a 400 error, never ignored.
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number, starting at 1. A page beyond the data is empty, not an error. At most 10000 pages: filter instead of paging deeper. Default: 1. |
per_page | integer | Results per page, from 1 to 100. Default: 25. |
sort | string | Sort fields, separated by commas, with - in front for descending order. Up to 3 fields. Sortable fields: id, name, code. Default: name. Default: name. |
search | string | Text contained in the store name or code. |
Response fields#
The list and the detail route return these fields. A field is null when the value is not recorded. A field marked needs permission is absent (not empty) unless your client holds that permission.
| Field | Type | Description |
|---|---|---|
id | integer | Unique identifier. Use it in the detail route. |
code | string| null | Store code. |
name | string| null | Store name. |
address | string| null | Street address. |
manager | string| null | Store manager. |
phone | string| null | Main phone number. |
phone2 | string| null | Second phone number. |
email | string| null | Store e-mail address. |
is_headquarters | boolean| null | true for the head office. |
Example response: list#
{
"data": [
{
"id": 1,
"code": "HQ",
"name": "Main store",
"address": "12 Rue Capois, Port-au-Prince",
"manager": "Jean Baptiste",
"phone": "+509 3700 0000",
"phone2": "",
"email": "main@example.com",
"is_headquarters": true
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"total_pages": 1
}
}Example response: one record#
{
"data": {
"id": 1,
"code": "HQ",
"name": "Main store",
"address": "12 Rue Capois, Port-au-Prince",
"manager": "Jean Baptiste",
"phone": "+509 3700 0000",
"phone2": "",
"email": "main@example.com",
"is_headquarters": true
}
}Errors#
The error format and the full list of codes are described in Errors.
| Status | When |
|---|---|
400 | A query parameter is invalid or unknown. Every fault is reported at once in error.details. Nothing is ignored silently. |
401 | The token is missing, malformed, expired or revoked (missing_token or invalid_token). Ask for a new token. |
403 | Your token does not carry the permission this route needs (insufficient_scope), or the request was not made over HTTPS (https_required). |
429 | Too many requests this minute. Wait for the number of seconds in the Retry-After header. |