Webhook support
Moclojer now supports webhooks, allowing for background requests to other APIs or endpoints
Is it possible to add a trigger when receiving a request on an endpoint (for the api world we call it a webhook):
Upon receiving a request for the /with-webhook
endpoint, the moclojer will respond with status 200
and body {"id": 123}
. In addition, it will make a request to the https://moclojer.com/api/webhook
endpoint with method POST
and body {"id": 123, "another-field": "it's working"}
.
sleep-time
(field is optional, default value of60 seconds
): is used to delay the request to the webhook endpoint, if you want to simulate a long processing time before sending the request;if
(field is optional, default value oftrue
): is used to define a condition to send the request to the webhook endpoint. If the condition is not met, the request will not be sent. It is possible to read all the request variables (path-params.
,query-params.
orjson-params.
), ending up as follows:if: json-params.field-name = "moclojer"
.operators:
=
,>
,<
,>=
,<=
moclojer will not wait for the response from the webhook endpoint; it will only send the request and continue to respond to the original request. This process is asynchronous.
Swagger:
GET
/with-webhook
When making a request to the /with-webhook
endpoint, the moclojer will respond with status 200
and body {"id": 123}
. In addition, it will make a request to the https://moclojer.com/api/webhook
endpoint with method POST
and body {"id": 123, "another-field": "it's working"}
.
Last updated