Aller directement à la fin des métadonnées
Aller au début des métadonnées

Vous regardez une version antérieure (v. /wiki/spaces/UDW54/pages/345417143/Webhook+g+n+ralit+s) de cette page.

afficher les différences afficher l'historique de la page

« Afficher la version précédente Vous regardez la version actuelle de cette page. (v. 8) afficher la version suivante »

Les webhook Métier permettent de manipuler une entité (client, contact, ...) à partir de l'extérieur via un appel de type http.
Les webhook Métier implémentent une structure commune de leur contrat JSON.

Entête

Le JSON lors de l'appel au webHook devra contenir les éléments suivants:

{
  "header": 
    {
       "caller": who called the webhook ie.: infinity
       "callerVersion": version of the caller ie. 1.2.3.4
       "languageCode": FR, EN, DE, PT, ES, IT, FR-CA, EN-CA
       "userCode": varchar
       "callDateTime": initial call date/time, usefull when retries or whatever network issue
    },
    "action":
    {
       "verb": "value", // GET, PUT, DELETE, LIST 
       "parameters": //depends on the verb
        {
        }
   },
   "data":
   {
      depends on the webhook
   }
}

Avec les possibilités suivantes selon le verb :

  • GET : lire un enregistrement
  • PUT: écrire un enregistrement
  • DELETE: supprimer un enregistrement
  • LIST: lister plusieurs enregistrements
"verb": GET
"parameters": 
{
   "code": code of the record to get (mandatory)
   "resultType":
      "simple" : main info of the record (by default),
      "extended": all columns of the record 
      "extendedRelated": all columns of the record+given context (one entity per foreign key)
}

"verb": PUT
"parameters": section not needed for a PUT
{
}

"verb": DELETE (V1: delete only record at a time)
"parameters": 
{
   "code": code of the record to delete (mandatory)
   "deleteType": 
      "logical": no real delete in db (by default)
      "physical": real delete, possible if record is not referred to elsewhere
}

"verb": LIST 
"parameters": 
{
   "listType": 
      "simple" : main info of the record (by default), the columns are determined by each webhook
      "extended": all columns of the record 
      "extendedRelated": all columns of the record+given context (one entity per foreign key)
   
   "filters": depends of the webhook called here for example intervention, not mandatory, each filter added will result is an AND in the query
     "codeIntervention": "value", filter is equal
     "codeCustomer": "value", filter is equal
     "codeContract": "value", filter is equal
     "startDate": "value", filter is greater or equal to
     "endDate": "value", filter is lesser or equal to
     "interventionType": "value", filter is equal

Réponse

Standard response of a webhook :

{
    "label": "Webhook Intervention", //name of the called webhook
    "codeScript": "WebhookIntervention", //script called by the webhook
    "resultType": "PlainText",
    "result": "see below",
    "statistics": {
        "durationMs": 1360, //duration of execution time
        "consumedTimeOnDatabaseMs": 990, //DB time used
        "readTokenCount": 1842, 
        "executedFunctionCount": 258, //number of function called
        "translatorHitCount": 552, //number of translations done
        "languageHitCount": 0 
    }
}

Detail for result :

"result":
{
  "common":
    {
      "resultCode": 0, //0 if ok otherwise specific error of the webhook
      "errorMessage": //if resultCode <>0, text of the error in english(V1)
    },
  "response":
  {
    depends on the webhook
  }
}

if the verb is LIST or GET, then response has 2 sections:

 "response":
  {
    "data":
      [{ depends of the webhook}],

    "fieldList": 
    [{
      "entityName": "value", // name of the table (ie intervention)
      "fields":
      [{
        "fieldName": "value", // name of the field (ie codeintervention, customer_ID, …)
        "fieldType": "value", // type of the field : varchar, text, int, double, bool, datetime, timestamp, foreignkey, generictype
        "fieldLength": "value", // length of the field : informed for varchar, text, foreignkey, generictype
        "fieldLabel": "value" // label of the field : depends on the value of the languageCode from the header (default : FR)
      },
      {
        "fieldName": "value",
        "fieldType": "value",
        "fieldLength": "value",
        "fieldLabel": "value"
      },
      {
        ...
      }],
      "related":
      [{
        "entityName": "value",
        "fields":
        [{
          ...
        }]
      },
      {
        "entityName": "value",
        "fields":
        [{
          ...
        }]
      },
      {
        ...  
      }]
    }]     
  • Aucune étiquette