adsum API, webhooks package (1.0.0)

Download OpenAPI specification:

License: GPL-2.0-or-later

What the webhooks package adds to the published contract when it is installed (see WebVision\Adsum\Core\Shared\Api\Contract\OpenApiDocument): the webhook subscriptions of a company, the events they can listen to and the log of the deliveries. Linted on its own.

Webhooks

Signed messages to the systems of a company when an employee is hired, changed or leaves.

List the events a webhook can listen to

The events of the installed packages, each with the fields of its data and their data category. Every field is of the category directory; an event with any other field cannot be registered.

Authorizations:
bearerAuthsessionCookie
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

List the webhook subscriptions of the company

Authorizations:
bearerAuthsessionCookie
query Parameters
page
integer >= 1
Default: 1
perPage
integer [ 1 .. 200 ]
Default: 50
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "meta": {
    }
}

Subscribe an address to events

Every event of the company the subscription listens to is sent to the address as a POST with a JSON document (id, event, occurredAt, companyId, data), signed with Adsum-Signature. The signing secret is in the answer once. HR without the admin role and employees receive 403.

Authorizations:
bearerAuthsessionCookie
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Request Body schema: application/json
required
name
required
string <= 200 characters
url
required
string <= 2048 characters

An https address (http where the installation allows it) that does not lead to the server itself, a private network or a metadata service; otherwise 422 on url.

events
required
Array of strings non-empty
status
string
Enum: "active" "disabled"

Only when updating. active resumes a suspended or paused subscription, disabled pauses it.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active"
}

Response samples

Content type
application/json
{
  • "id": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active",
  • "secretSet": true,
  • "secret": "string",
  • "failingSince": "2019-08-24T14:15:22Z",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Read a webhook subscription

The secret is never returned; secretSet says it exists.

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "id": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active",
  • "secretSet": true,
  • "secret": "string",
  • "failingSince": "2019-08-24T14:15:22Z",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Change a webhook subscription

Needs If-Match. status: active resumes a suspended or paused subscription; the failures so far count no more.

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

If-Match
required
string

ETag of the representation being modified (optimistic locking). A stale value yields 412.

Request Body schema: application/json
required
name
required
string <= 200 characters
url
required
string <= 2048 characters

An https address (http where the installation allows it) that does not lead to the server itself, a private network or a metadata service; otherwise 422 on url.

events
required
Array of strings non-empty
status
string
Enum: "active" "disabled"

Only when updating. active resumes a suspended or paused subscription, disabled pauses it.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active"
}

Response samples

Content type
application/json
{
  • "id": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active",
  • "secretSet": true,
  • "secret": "string",
  • "failingSince": "2019-08-24T14:15:22Z",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Delete a webhook subscription with its deliveries

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/problem+json
{
  • "type": "../dictionary",
  • "title": "string",
  • "status": 0,
  • "detail": "string",
  • "instance": "../dictionary",
  • "code": 0,
  • "correlationId": "string",
  • "violations": [
    ],
  • "dependents": [
    ]
}

Give a subscription a new signing secret

The new secret is in the answer once. The previous secret signs beside it for 24 hours (a second v1 value in Adsum-Signature), so the receiver can switch over.

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "id": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "name": "string",
  • "url": "string",
  • "events": [
    ],
  • "status": "active",
  • "secretSet": true,
  • "secret": "string",
  • "failingSince": "2019-08-24T14:15:22Z",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Send the event `ping` to a subscription at once

Sent synchronously and not kept as a delivery; the answer reports the status code and the duration.

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "succeeded": true,
  • "statusCode": 0,
  • "durationMs": 0,
  • "error": "string"
}

List the deliveries of the last 30 days

Each delivery with its event, status, attempts, the status code and duration of the last attempt, the first 2048 bytes of the answer and the document that was sent. Employees and HR without the admin role receive 403.

Authorizations:
bearerAuthsessionCookie
query Parameters
status
string
Enum: "queued" "succeeded" "failed"
subscriptionId
string <uuid> (Uuid)
Examples: subscriptionId=0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
page
integer >= 1
Default: 1
perPage
integer [ 1 .. 200 ]
Default: 50
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "meta": {
    }
}

Send a delivery again

Queued again under the same Adsum-Delivery ID with a fresh set of attempts.

Authorizations:
bearerAuthsessionCookie
path Parameters
id
required
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b
header Parameters
Company-Id
string <uuid> (Uuid)
Examples: 0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b

Company context of the request. Defaults to the user's home company. A company the user has no role in yields 403.

Responses

Response samples

Content type
application/json
{
  • "id": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "subscriptionId": "0192a3c4-5d6e-7f80-9a1b-2c3d4e5f6a7b",
  • "event": "string",
  • "status": "queued",
  • "attempts": 0,
  • "responseCode": 0,
  • "durationMs": 0,
  • "responseExcerpt": "string",
  • "error": "string",
  • "nextAttemptAt": "2019-08-24T14:15:22Z",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "payload": { }
}