Sommaire |
---|
Introduction
Les webhooks Métier permettent de manipuler une entité (client, contact, ...) à partir de l'extérieur via un appel de type http.
Les webhooks Métier implémentent une structure commune de leur contrat JSON.
Entête
Structure
Le JSON lors de l'appel au webHook devra contenir les éléments suivants :
...
Bloc de code | ||
---|---|---|
| ||
"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
Structure
Bloc de code | ||
---|---|---|
| ||
{ "label": "Webhook xxx", //name of the called webhook "codeScript": "Webhookxxx", //script called by the webhook "resultType": "JSON", "result": { "common": { "resultCode": "0", // 0 if ok otherwise specific error of the webhook "errorMessage": "" // if resultCode <> 0, text of the error in english }, "response": { // depends of the webhook } }, "statistics": { "durationMs": xx, // duration of execution time "consumedTimeOnDatabaseMs": xx, // DB time used "selectQueryCount": xx, // number of select query done "insertQueryCount": xx, // number of insert query done "updateQueryCount": xx, // number of update query done "deleteQueryCount": xx, // number of delete query done "readTokenCount": xx, "executedFunctionCount": xx, // number of function called "translatorHitCount": xx, // number of translations done "languageHitCount": xx } } |
...
Bloc de code | ||
---|---|---|
| ||
"response":
{
"maxElementAtOnce": "10" // max elements that can be passed at once
"data":
[{
"action": "value", // inserted or updated
"xxxxx_ID": "value", // with xxxxx = table and value is ID created/updated
"codexxxxx": "value" // with xxxx = table and value is code created/updated
}]
} |
...
Bloc de code | ||
---|---|---|
| ||
"result": { "results": [{ "common": { "resultCode": "0", // 0 if ok otherwise specific error of the webhook "errorMessage": "" // if resultCode <> 0, text of the error in english }, "response": { "maxElementAtOnce": "10" // max elements that can be passed at once "data": [{ "action": "value", // inserted or updated "xxxxx_ID": "value", // with xxxxx = table and value is ID created/updated "codexxxxx": "value" // with xxxx = table and value is code created/updated }] } }, { "common": { "resultCode": "0", "errorMessage": "" }, "response": { "maxElementAtOncedata": "10" // max elements that can be passed at once "data": [{ "action": "value", "xxxxx_ID": "value", "codexxxxx": "value" }] } }, { ... }] } |
...
Bloc de code | ||
---|---|---|
| ||
"response": { "data": [{ // depends of the webhook"fieldName1": [{ }],"code": "value", As an example for contact "generictype_ID_civility":"label": "value" }, { "code": "value", "label": "value" }, { ... } }], "fieldName2": [{ "code": "value", "label": "value" }, [{ "code": "CIVILITY-MRvalue", "label": "Monsieurvalue" }, { ... "code": "CIVILITY-MME" } }], "label": "Madame" ... }], "fieldList": [{ "entityName": "value", // name of the entity (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", // 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) "canotBeNullcannotBeNull": "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", "canotBeNullcannotBeNull": "value", "dataType": "value" }, { ... }], "related": [{ "entityName": "value", "fields": [{ ... }] }, { "entityName": "value", "fields": [{ ... }] }, { ... }] }] |