Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Productstyle icon link MinimalConfig

Het aanmaken, veranderen en verwijderen van Locaties en Categorieën kan op 2 manieren:

  • CRUD: CRUD staat voor Create, Read, Update en Delete. Het is de manier om te communiceren met de Touch Pro als het externe apparaat daarvoor geschikt is. De API's staan uitgelegd bij Locaties en Categorieën.
  • MinimalConfig: voor externe apparaten zoals PLC's kan het lastig zijn om via de CRUD manier te werken. Als alternatief kan met slechts 1 API methode Locaties en Categorieën worden aangemaakt, aangepast en verwijderd worden.

MinimalConfig

API elementen met hun beschrijving

ElementBeschrijving
custom_idUnieke locatie ID gedefinieerd door de klant.
topicUnieke aangepaste ID voor de categorie.
nameNaam van de categorie. Wordt gebruikt in het logboek en op het display.
nameNaam van de locatie. Wordt gebruikt in het alarmrapport (spraak of tekst) en in het logboek en op het display.

Er zijn alleen een GET en een POST API beschikbaar voor MinimalConfig. Om elementen achteraf te kunnen wijzigen of verwijderen moet een nieuwe POST gedaan worden met de juiste gegevens.

API methoden

In de situatieschets zijn twee locaties: Tomaten en Paprika's.

"Post: /MinimalConfig"

{
  "locations": [
    {
      "categories": [
        {
          "name": "Cult. Urgent",
          "topic": "cultivation_urg"
        }
      ],
      "custom_id": "loc_01",
      "name": "Tomatoes"
    },
    {
      "categories": [
        {
          "name": "Cult. Not Urgent",
          "topic": "cultivation_not_urg"
        }
      ],
      "custom_id": "loc_02",
      "name": "Peppers"
    }
  ]
}

cURL code:

curl -X 'POST' \
  'http://192.168.10.72/rest_api/1/MinimalConfig' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI1MzQ0ODgsIm5iZiI6MTYxMjUzNDQ4OCwianRpIjoiNjY0NzI2NzAtYTRkMi00N2ZmLWFiMjUtNzAyMGYwOTkwNWJhIiwiZXhwIjoxNjEyNTM3OTg4LCJpZGVudGl0eSI6IlJFU1QtQVBJXzAwMDUiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2NsYWltcyI6eyJ1c2VyX2lkIjo1LCJyb2xlX2lkIjo1LCJsYW5ndWFnZSI6Im5sLU5MIn19.6xlCrMjNsKd9Eyq5ieS-MScZe6P1idstMCKPs5dfOd8' \
  -H 'Content-Type: application/json' \
  -d '{
  "locations": [
    {
      "categories": [
        {
          "name": "Cult. Urgent",
          "topic": "cultivation_urg"
        }
      ],
      "custom_id": "loc_01",
      "name": "Tomatoes"
    },
    {
      "categories": [
        {
          "name": "Cult. Not Urgent",
          "topic": "cultivation_not_urg"
        }
      ],
      "custom_id": "loc_02",
      "name": "Peppers"
    }
  ]
}'

Respons:

{
  "locations": [
    {
      "name": "Tomatoes",
      "custom_id": "loc_01",
      "categories": [
        {
          "name": "Cult. Urgent",
          "topic": "cultivation_urg"
        }
      ]
    },
    {
      "name": "Peppers",
      "custom_id": "loc_02",
      "categories": [
        {
          "name": "Cult. Not Urgent",
          "topic": "cultivation_not_urg"
        }
      ]
    }
  ]
}

Wanneer alle data is toegevoegd, kunt u deze locaties opvragen met de API "GET: /MinimalConfig".

"GET: /MinimalConfig"

cURL code:

curl -X 'GET' \
  'http://192.168.10.72/rest_api/1/MinimalConfig' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI1MzQ0ODgsIm5iZiI6MTYxMjUzNDQ4OCwianRpIjoiNjY0NzI2NzAtYTRkMi00N2ZmLWFiMjUtNzAyMGYwOTkwNWJhIiwiZXhwIjoxNjEyNTM3OTg4LCJpZGVudGl0eSI6IlJFU1QtQVBJXzAwMDUiLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2NsYWltcyI6eyJ1c2VyX2lkIjo1LCJyb2xlX2lkIjo1LCJsYW5ndWFnZSI6Im5sLU5MIn19.6xlCrMjNsKd9Eyq5ieS-MScZe6P1idstMCKPs5dfOd8'

Respons:

{
  "locations": [
    {
      "name": "Tomatoes",
      "custom_id": "loc_01",
      "categories": [
        {
          "name": "Cult. Urgent",
          "topic": "cultivation_urg"
        }
      ]
    },
    {
      "name": "Peppers",
      "custom_id": "loc_02",
      "categories": [
        {
          "name": "Cult. Not Urgent",
          "topic": "cultivation_not_urg"
        }
      ]
    }
  ]
}

Als de Locaties en Categorieën zijn aangemaakt, is de REST API klaar voor de alarmering. Hoe de alarmering werkt staat uitgelegd in Alarm rapportage.