Locaties
Goed om te weten: werkt u met MinimalConfig? Dan voegt het systeem locaties en categorieën automatisch toe. U kunt deze stap dan overslaan.
Let op: controleer of de hardware en software geschikt zijn voordat u locaties en categorieën aanmaakt. Zie versiecontroles voor de API-methoden.
Omdat elke locatie een eigen alarmafhandeling heeft, voegt u elke locatie afzonderlijk toe aan de REST API-koppeling. Zo rapporteert iedere locatie zelfstandig.
Beschrijving van de API-elementen
| Element | Beschrijving |
|---|---|
| custom_id | De unieke locatie-ID die u zelf bepaalt. |
| enabled | Geeft aan of het systeem uitgeschakeld is, bijvoorbeeld bij onderhoud (false). |
| id | De unieke database-ID die de Octalarm alarmmelder automatisch genereert. |
| name | De naam van de locatie. De melder toont deze naam: 1. bij het genereren van alarmmeldingen; 2. in het alarmrapport (spraak of tekst); 3. in het logboek en op het scherm. |
U kunt alle elementen, behalve het element id, later aanpassen met behulp van de custom_id en de PUT-methode.
API-methoden
In de situatieschets van het praktijkvoorbeeld staan twee locaties: Tomaten en Paprika's.
POST: /Locations
{
"custom_id": "loc_01",
"enabled": true,
"name": "Tomatoes"
}
cURL-code:
curl -X 'POST' \
'http://192.168.10.72/rest_api/1/Locations' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI1MzQ0ODgsIm5iZiI6MTYxMjUzNDQ4OCwianRpIjoiNjY0NzI2NzAtYTRkMi00N2ZmLWFiMjUtNzAyMGYwOTkwNWJhIiwiZXhwIjoxNjEyNTM3OTg4LCJpZGVudGl0eSI6IlJFU1QtQVBJXzAwMDUiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2NsYWltcyI6eyJ1c2VyX2lkIjo1LCJyb2xlX2lkIjo1LCJsYW5ndWFnZSI6Im5sLU5MIn19.6xlCrMjNsKd9Eyq5ieS-MScZe6P1idstMCKPs5dfOd8' \
-H 'Content-Type: application/json' \
-d '{
"custom_id": "loc_01",
"enabled": true,
"name": "Tomatoes"
}'
Respons:
{
"id": 3,
"name": "Tomatoes",
"custom_id": "loc_01",
"enabled": true
}
Zodra u alle locaties hebt toegevoegd, vraagt u deze locaties op via de API GET: /Locations.
GET: /Locations
cURL-code:
curl -X 'GET' \
'http://192.168.10.72/rest_api/1/Locations' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI1MzQ0ODgsIm5iZiI6MTYxMjUzNDQ4OCwianRpIjoiNjY0NzI2NzAtYTRkMi00N2ZmLWFiMjUtNzAyMGYwOTkwNWJhIiwiZXhwIjoxNjEyNTM3OTg4LCJpZGVudGl0eSI6IlJFU1QtQVBJXzAwMDUiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2NsYWltcyI6eyJ1c2VyX2lkIjo1LCJyb2xlX2lkIjo1LCJsYW5ndWFnZSI6Im5sLU5MIn19.6xlCrMjNsKd9Eyq5ieS-MScZe6P1idstMCKPs5dfOd8'
Respons:
{
"locations": [
{
"id": 3,
"name": "Tomatoes",
"custom_id": "loc_01",
"enabled": true
},
{
"id": 4,
"name": "Peppers",
"custom_id": "loc_02",
"enabled": true
}
]
}
PUT: /Locations/CusomId/loc_01
{
"name": "Cucumber"
}
cURL-code:
curl -X 'PUT' \
'http://192.168.10.72/rest_api/1/Locations/CustomId/loc_01' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI1MzQ0ODgsIm5iZiI6MTYxMjUzNDQ4OCwianRpIjoiNjY0NzI2NzAtYTRkMi00N2ZmLWFiMjUtNzAyMGYwOTkwNWJhIiwiZXhwIjoxNjEyNTM3OTg4LCJpZGVudGl0eSI6IlJFU1QtQVBJXzAwMDUiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2NsYWltcyI6eyJ1c2VyX2lkIjo1LCJyb2xlX2lkIjo1LCJsYW5ndWFnZSI6Im5sLU5MIn19.6xlCrMjNsKd9Eyq5ieS-MScZe6P1idstMCKPs5dfOd8' \
-H 'Content-Type: application/json' \
-d '{
"name": "Cucumber"
}'
Respons:
{
"id": 3,
"name": "Cucumber",
"custom_id": "loc_01",
"enabled": true
}
Nadat u één of meer locaties heeft aangemaakt, kunt u binnen elke locatie verschillende categorieën aanmaken om de alarmen overzichtelijk te verdelen per locatie of groep.