|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Outbound webhooks / IFTTT (PROTOCORE_ENABLE_WEBHOOK). More...
#include "protocore_config.h"Go to the source code of this file.
Outbound webhooks / IFTTT (PROTOCORE_ENABLE_WEBHOOK).
A webhook is an HTTP POST the device originates. The pattern itself is not standardized: no IETF RFC defines "webhook", and the IFTTT Maker interface these builders target is one service's own URI convention. What is standardized is everything that POST rides on.
RFC 9110 sec 9.3.3: "The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics." The resource is named by the target URI (RFC 9110 sec 7.1), here an https URI (RFC 9110 sec 4.2.2) whose path is a sequence of segments (RFC 3986 sec 3.3). The content (RFC 9110 sec 6.4) is a JSON object (RFC 8259 sec 4) carried under Content-Type application/json (RFC 9110 sec 8.3; the media type is registered in RFC 8259 sec 11) with a Content-Length taken from its octet count (RFC 9110 sec 8.6). The answer is a three-digit status code (RFC 9110 sec 15.1): 2xx says the request was received, understood, and accepted (RFC 9110 sec 15.3); 4xx and 5xx say it was not (RFC 9110 sec 15.5, sec 15.6).
The two builders are pure and host-testable. Sending needs PROTOCORE_ENABLE_HTTP_CLIENT: on a build without it ::WebhookNs::post reports -1 and nothing is transmitted.
The module exports one symbol, Webhook. Everything in webhook.c has internal linkage.
Definition in file webhook.h.