API | How to create an API watcher and define its schema to meet your requirements

Publié environ 1 an il y a par  Julien Pauthier

Publier un sujet
  • Sujet épinglé
Julien Pauthier
Julien Pauthier Administrateur

You can apply a specific template to the JSON format of your API watcher to map the data to the JSON properties of your endpoint. You can even use jsonpath expressions to map data to the target schema (checkout the example provided along our Appointments watcher).


Here is an example of a template applied to an Appointments event watcher (creation or update): 


{
  "address": "https://webhook.site/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
  "events": [
    "updated", "created"
  ],
  "schema": {
    "id": "${$.id}",
    "staff": "${$.staff.firstName} ${$.staff.lastName}",
    "firstName": "${$.client.firstName}",
    "lastName": "${$.client.lastName}",
    "email": "${$.client.email}",
    "phone": "${$.client.phone}",
    "datetime": {
      "start": "${$.start.dateTime}",
      "end": "${$.end.dateTime}"
    },
    "appointment": "${$.service.name}"
  },
  "addPreviousData": "false"
}


0 Votes


0 Commentaires

Connexion ou S'inscrire pour poster un commentaire