PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → Webhooks
Webhooks
Débuté par Stephen, 19 juin 2019 04:27 - 1 réponse
Membre enregistré
18 messages
Popularité : +1 (1 vote)
Posté le 19 juin 2019 - 04:27
Does anyone have any experience building services for providing webhooks in WxDev? I assume it can be done in programming, obviously, but wondering if there is a built-in function we are not yet familiar with that we can take advantage of.
Posté le 11 décembre 2019 - 12:28
Hi Stephen,

I have never found any component, integrated function to provide webhooks built-in services.

I have just trigger IFTTT webhooks services with windev, something very easy to do.

oRequête est un httpRequête
oRéponse est un httpRéponse
chaineReponse est Variant

// Prépare la requête

E_IFTT_URL="https://maker.ifttt.com/trigger/PERSONAL_EVENT_NAME/with/key/PERSONAL_IFTT_KEY"
oRequête..URL = E_IFTT_URL
oRequête..ContentType = "application/json"

// Transmet la requête
oRéponse = HTTPEnvoie(oRequête)
SELON oRéponse..CodeEtat
CAS 200:
chaineReponse =AnsiVersUnicode(oRéponse..Contenu)
Info("OK"+RC+chaineReponse)


CAS 400, 500:

vErreur est un Variant = JSONVersVariant(oRéponse..Contenu)
ExceptionDéclenche(oRéponse..CodeEtat, vErreur.code + RC + vErreur.message)

CAS 415:
ExceptionDéclenche(415, "Format non supporté")

AUTRES CAS:
ExceptionDéclenche(500, "Erreur HTTP " + oRéponse..CodeEtat)
FIN


Laurent