Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Konsole: integrations

Als Markdown kopieren

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als Authorization: Bearer ndt_...; siehe API-Tokens. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

Webhooks and notification channels: where events go, the delivery log.

GET /api/integrations/channels

List the notification channels by name.

For picking channels in an alert rule or a workflow step: no settings, no secrets. Sorted by name. Needs server.config or org.manage_devices.

Needs server.config or org.manage_devices. neodesk integrations channels calls it.

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.channels array of object yes
data.channels[].id string yes
data.channels[].name string yes
data.channels[].kind string, one of slack, teams, discord, ntfy, gotify, pushover yes
data.channels[].enabled boolean yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

GET /api/integrations/deliveries/{id}

Show one delivery with the event it carried.

When the event is gone from the log, event holds only its id and type.

Needs server.config. neodesk integrations delivery calls it.

Parameter In Type Required What it is
id path string yes The delivery's ID (see integrations deliveries)

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.delivery IntegrationDelivery yes
data.event IntegrationEvent yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such delivery
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

POST /api/integrations/deliveries/{id}/redeliver

Send a delivery again.

Queues the same delivery again, due now: a delivery that ended starts over as pending with 0 attempts, a pending one becomes due now. The sending happens in the background; the answer is the delivery as queued. Writes integration_redelivered to the audit log.

Needs server.config. neodesk integrations redeliver calls it.

Parameter In Type Required What it is
id path string yes The delivery's ID (see integrations deliveries)

200: The delivery as queued (application/json)

Field Type Required
success true yes
data IntegrationDelivery yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such delivery
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

GET /api/integrations/events

List the events webhooks and channels can subscribe to.

webhook.test, which the test sends, is not in the list: it can't be subscribed to.

Needs server.config. neodesk integrations events calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.events array of string, one of alert.raised, alert.acknowledged, device.online, device.offline, device.deleted, device.id_changed, device.join_requested, help_request.opened, help_request.closed, ticket.created, ticket.changed, ticket.commented, ticket.closed, session.started, session.ended, quick_support.feedback, chat.waiting, workflow.alert, workflow.message, audit.entry, signin.succeeded, signin.failed, signin.blocked, signin.locked_out, signin.second_factor_required, signin.second_factor_failed, alert.summary, maintenance.started, maintenance.ended yes In the order the console lists them
data.payload_version integer yes The version of the webhook payload; it goes up when a field is removed or renamed
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

GET /api/integrations/rule-channels

List the notification channels of every alert rule that has some.

Needs server.config. neodesk integrations rule-channels calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.rules object yes The alert rule's ID to the IDs of its channels; rules without channels are left out
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

GET /api/integrations/rule-channels/{ruleId}

Show the notification channels an alert rule's alerts go to.

Besides these, an alert goes to every channel that subscribes to alert.raised.

Needs server.config. neodesk integrations rule-channels-get calls it.

Parameter In Type Required What it is
ruleId path string yes The alert rule's ID (see automation rules)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.rule_id string yes The alert rule's ID
data.channels array of string yes The channels' IDs, by the channels' names; channels that were deleted are left out
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such alert rule
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

PUT /api/integrations/rule-channels/{ruleId}

Set the notification channels an alert rule's alerts go to.

Replaces the rule's channels; an empty list removes them. IDs given twice count once. An alert of the rule goes to these channels and to every channel that subscribes to alert.raised, once each. Writes alert_rule_channels_changed to the audit log when the list changed.

Needs server.config. neodesk integrations rule-channels-set calls it.

Parameter In Type Required What it is
ruleId path string yes The alert rule's ID (see automation rules)

Request body, application/json:

Field Type Required What it is
channels array of string yes The channels' IDs (see integrations channels), at most 20; each must be a notification channel that exists; at most 20 items

200: The rule's channels as stored (application/json)

Field Type Required What it is
success true yes
data object yes
data.rule_id string yes The alert rule's ID
data.channels array of string yes The channels' IDs, by the channels' names; channels that were deleted are left out
Error When
400 channels is missing or not a list (code invalid_channels), names something that is not a notification channel, or holds more than 20 (code invalid_channels)
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such alert rule
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

GET /api/integrations/targets

List the webhooks and notification channels, with secrets masked.

Oldest first.

Needs server.config. neodesk integrations list calls it.

Parameter In Type What it is
kind query string Only this kind, or several separated by commas (webhook,slack)

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.targets array of IntegrationTarget yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

POST /api/integrations/targets

Add a webhook or notification channel.

A webhook without a secret gets a random one (whsec_ and 43 characters); the answer holds the secret in clear, the only time it is shown. Writes integration_created to the audit log.

Needs server.config. neodesk integrations create calls it.

Request body, application/json:

IntegrationTargetInput.

200: The integration as stored (application/json)

Field Type Required
success true yes
data IntegrationTarget yes
Error When
400 The body is not a valid integration, the kind is unknown, or a field is not valid: code is then invalid_ and the field's name, such as invalid_kind, invalid_url or invalid_events
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server, or the server can't store secrets because its key file for integrations could not be loaded

GET /api/integrations/targets/{id}

Show one webhook or channel, with secrets masked.

Needs server.config. neodesk integrations show calls it.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)

200: Done (application/json)

Field Type Required
success true yes
data IntegrationTarget yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

PATCH /api/integrations/targets/{id}

Change a webhook or channel.

Give the fields to change; kind stays. A secret, header value or credential sent as ******** keeps the stored value. Switching it off cancels the deliveries still waiting; switching it on again clears its run of failures. Writes integration_changed, integration_enabled or integration_disabled to the audit log when something changed.

Needs server.config. neodesk integrations update calls it.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)

Request body, application/json:

IntegrationTargetInput.

200: The integration as stored (application/json)

Field Type Required
success true yes
data IntegrationTarget yes
Error When
400 The body is not a valid integration, or a field is not valid: code is then invalid_ and the field's name, such as invalid_url or invalid_events
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server, or the server can't store secrets because its key file for integrations could not be loaded

DELETE /api/integrations/targets/{id}

Delete a webhook or channel.

Deliveries still waiting for it are cancelled; its delivery log stays until it ages out after 30 days. Writes integration_deleted to the audit log.

Needs server.config. neodesk integrations delete calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.deleted string yes The ID of the integration deleted
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

GET /api/integrations/targets/{id}/deliveries

List the newest deliveries of a webhook or channel.

Newest first. Deliveries that ended more than 30 days ago are gone.

Needs server.config. neodesk integrations deliveries calls it.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)
limit query integer How many, at most 200; 50 when left out, 0 or more than 200; default 50, at most 200

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.deliveries array of IntegrationDelivery yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

POST /api/integrations/targets/{id}/secret

Give a webhook a new signing secret.

The old secret stops working at once. The answer is the only time the new one is shown. Writes integration_secret_rotated to the audit log.

Needs server.config. neodesk integrations rotate-secret calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.secret string yes whsec_ and 43 characters
Error When
400 The integration is not a webhook: only webhooks have a signing secret
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server, or the server can't store secrets because its key file for integrations could not be loaded

POST /api/integrations/targets/{id}/test

Send a test event to a webhook or channel now and show the answer.

Sends the event webhook.test once, also to an integration that is switched off. The test is not retried and doesn't count against the integration's run of failures. A receiver that refuses it still answers 200, with status failed. Writes integration_tested to the audit log.

Needs server.config. neodesk integrations test calls it.

Parameter In Type Required What it is
id path string yes The integration's ID (see integrations list)

200: The test's delivery: status succeeded or failed, with the receiver's answer (application/json)

Field Type Required
success true yes
data IntegrationDelivery yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such integration
500 Something failed on the server (the text of errors.server_error)
503 Integrations are not available on this server

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.