@@ -198,6 +198,81 @@ about the project, including the status of any pipeline run:
198198 "created_date" : " 2021-07-21T16:06:29.132795+02:00"
199199 }
200200
201+ .. _rest_api_webhooks :
202+
203+ Adding webhooks
204+ ^^^^^^^^^^^^^^^
205+
206+ When creating a project, you can also **register webhook subscriptions ** that will
207+ notify external services about pipeline execution events.
208+
209+ You can either provide:
210+ - A **single webhook URL ** using the ``webhook_url `` field.
211+ - A **list of detailed webhook configurations ** using the ``webhooks `` field.
212+
213+ Webhook fields:
214+ - ``webhook_url `` (string, optional): A single webhook URL to be notified.
215+ - ``webhooks `` (list, optional): A list of webhook configurations.
216+ - ``target_url `` (string, required): The URL to which the webhook will send a
217+ ``POST `` request.
218+ - ``trigger_on_each_run `` (boolean, optional): If ``true ``, the webhook will be
219+ triggered after each individual pipeline run. Default is ``false ``.
220+ - ``include_summary `` (boolean, optional): If ``true ``, the webhook payload
221+ will include the summary data of the pipeline execution. Default is ``false ``.
222+ - ``include_results `` (boolean, optional): If ``true ``, the webhook payload
223+ will include the full results data of the pipeline execution.
224+ Default is ``false ``.
225+ - ``is_active `` (boolean, optional): If ``true ``, the webhook is active and
226+ will be triggered when the specified conditions are met. Default is ``true ``.
227+
228+ Using cURL to register a webhook:
229+
230+ .. code-block :: console
231+
232+ api_url="http://localhost/api/projects/"
233+ content_type="Content-Type: application/json"
234+ data='{
235+ "name": "project_name",
236+ "webhook_url": "https://example.com/webhook"
237+ }'
238+
239+ curl -X POST "$api_url" -H "$content_type" -d "$data"
240+
241+ .. code-block :: json
242+
243+ {
244+ "name" : " project_name" ,
245+ "webhook_url" : " https://example.com/webhook"
246+ }
247+
248+ Using cURL to register multiple webhooks:
249+
250+ .. code-block :: console
251+
252+ api_url="http://localhost/api/projects/"
253+ content_type="Content-Type: application/json"
254+ data='{
255+ "name": "project_name",
256+ "webhooks": [
257+ {
258+ "target_url": "https://example.com/webhook1",
259+ "trigger_on_each_run": true,
260+ "include_summary": false,
261+ "include_results": true,
262+ "is_active": true
263+ },
264+ {
265+ "target_url": "https://example.com/webhook2",
266+ "trigger_on_each_run": false,
267+ "include_summary": true,
268+ "include_results": false,
269+ "is_active": true
270+ }
271+ ]
272+ }'
273+
274+ curl -X POST "$api_url" -H "$content_type" -d "$data"
275+
201276 Project details
202277---------------
203278
@@ -278,6 +353,8 @@ Using cURL to upload a local file:
278353 "status" : " Input(s) added."
279354 }
280355
356+ .. _rest_api_add_pipeline :
357+
281358Add pipeline
282359^^^^^^^^^^^^
283360
@@ -315,6 +392,58 @@ Using cURL:
315392 "status" : " Pipeline added."
316393 }
317394
395+ .. _rest_api_add_webhook :
396+
397+ Add webhook
398+ ^^^^^^^^^^^
399+
400+ This action adds a webhook subscription to the ``project ``.
401+ A webhook allows external services to receive real-time notifications about project
402+ pipeline execution events.
403+
404+ ``POST /api/projects/d4ed9405-5568-45ad-99f6-782a9b82d1d2/add_webhook/ ``
405+
406+ Data:
407+ - ``target_url `` (string, required): The URL to which the webhook will send
408+ a ``POST `` request when triggered.
409+ - ``trigger_on_each_run `` (boolean, optional): If ``true ``, the webhook will be
410+ triggered after each individual pipeline run. Default is ``false ``.
411+ - ``include_summary `` (boolean, optional): If ``true ``, the webhook payload will
412+ include the summary data of the pipeline execution. Default is ``false ``.
413+ - ``include_results `` (boolean, optional): If ``true ``, the webhook payload will
414+ include the full results data of the pipeline execution. Default is ``false ``.
415+ - ``is_active `` (boolean, optional): If ``true ``, the webhook is active and will
416+ be triggered when the specified conditions are met. Default is ``true ``.
417+
418+ Using cURL:
419+
420+ .. code-block :: console
421+
422+ api_url="http://localhost/api/projects/6461408c-726c-4b70-aa7a-c9cc9d1c9685/add_webhook/"
423+ content_type="Content-Type: application/json"
424+ data='{
425+ "target_url": "https://example.com/webhook",
426+ "trigger_on_each_run": true,
427+ "include_summary": true,
428+ "include_results": false,
429+ "is_active": true
430+ }'
431+
432+ curl -X POST "$api_url" -H "$content_type" -d "$data"
433+
434+ .. code-block :: json
435+
436+ {
437+ "status" : " Webhook added."
438+ }
439+
440+ .. note ::
441+ - Webhooks will only be triggered for active subscriptions.
442+ - If ``trigger_on_each_run `` is set to ``false ``, the webhook will only trigger
443+ after all pipeline runs are completed.
444+ - The ``include_summary `` and ``include_results `` fields allow customization of
445+ the webhook payload.
446+
318447Archive
319448^^^^^^^
320449
0 commit comments