Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.
Commentaire: Published by Scroll Versions from space VERSIONSWEAVY and version 5.4

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:

Info
{
  "header": 
    {
       "caller": whohow 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": varcharuser how called the webhook
       "callDateTime": initial call date/time, usefull when retries or whatever network issue
       "markForExport": value for srvExport of the table, can be 0, 1, 2 (optional, default is 1)
       "webhookVersion": version of the webhook for top-down compatibility, can be 1 or 2 (optional, default is 1). 
Today it is used for webhooks intervention, equipment and contract. }, "action": { "verb": "value", // GET, PUT, DELETE, LIST, DEFINITION "parameters": //depends on the verb { } }, "data": { depends on the webhook } }

...

  • GET : lire un enregistrement
  • PUT: écrire un enregistrement
  • DELETE: supprimer un enregistrement
  • LIST: lister plusieurs enregistrements
  • DEFINITION : obtenir les propriétés de l'objet métier ainsi que les listes de valeurs possibles associées
Info
"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)
   "settings": depends of the webhook (optional)
   {

   }
}

"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
      "simulation": simulate the delete (can be used to know in advance if a record can be deleted)
}

"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 not used for verb=LIST
   
   "pageNumber": xx, // used to read the page of the record+given context (one entity per foreign key)
 records list, 1 page = 10 records (optional, default pageNumber is 1)
                        You can read the list page per page until maxPageNumber (result of maxPageNumber given in the "response")
   "settings": depends of the webhook (optional)
   {

   }
   "filters": depends of the webhook called here for example intervention, not mandatory, each filter added will result is an AND in the query
              For a filter operator "equal" it is possible to give more values separated by "|" (ie "email": "email1|email2|email3")
     "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
}

"verb": DEFINITION
"parameters":
{
  "baseculture_id": "value" : (optional) Culture to use to return labels. If not given, the LanguageCode of the header will be used by default.
}

Réponse

Standard response of a webhook :

...

Info
"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 PUT, then response has 1 section:

Info

 "response": 
  {
    "data": 
    [{
      "xxxxx_ID": "value" // with xxxx = table and value is ID created
    }]
  }

if the verb is DELETE, then response has 1 section:

Info


if the verb is DELETE, then response has 1 empty section :
  "response": 
  {
    "data": 
    []
  }



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

Info
 "response":
  {
    "maxPageNumber": xx, // verb=LIST : number of pages of records
    "pageSize": 10, // verb=LIST : number of records per page
    "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
        "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":
        [{
          ...
        }]
      },
      {
        ...  
      }]
    }]   

if the verb is DEFINITION, then response has 2 sections:

Info
"response":
  {
    "data":
      [{ depends of the webhook}],
     As an example for contact
     "generictype_ID_civility":
       [{ "code": "CIVILITY-MR",
       "label": "Mister"
        },
        { "code": "CIVILITY-MME",
          "label": "Madame"
        },
        { "code": "CIVILITY-MRS",
          "label": "Miss"
        }
      ],

    "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
        "fieldLength": "value", generictype // length of the field : informed for varchar, text
        "fieldLabel": "value", // label of the field : depends on the value of the languageCode from the header (default : FR)
        "fieldNameToShow": "value", // field alias for GET and LIST
        "alias": "value", // field alias for PUT
        "canGet": "value", // field can be read (0, 1)
        "canInsert": "value", // field can be updated for a new record (0, 1)
        "canUpdate": "value", // field can be updated for a existing record (0, 1)
        "mandatory": "value", // field is mandatory in sent json (0, 1)
        "canotBeNull": "value", // field cannot be null or empty in sent json (0, 1)
        "dataType": "value" // data type for generictype foreignkey field
      },
      {
        "fieldName": "value",
        "fieldType": "value",
        "fieldLength": "value",
        "fieldLabel": "value",
        "fieldNameToShow": "value",
        "alias": "value",
        "canGet": "value",
        "canInsert": "value",
        "canUpdate": "value",
        "mandatory": "value",
        "canotBeNull": "value",
        "dataType": "value"
      },
      {
        ...
      }],
      "related":
      [{
        "entityName": "value",
        "fields":
        [{
          ...
        }]
      },
      {
        "entityName": "value",
        "fields":
        [{
          ...
        }]
      },
      {
        ...  
      }]
    }]