Add a new subscription
POST
/subscriptionsAuthorization
AuthorizationBearer token (JWT) · headerrequiredRequest body
requiredapplication/jsonNew event to be distributed to subscribers.
typestringrequiredAllowed:
PUBSUBmethodstringrequiredAllowed:
PUSHurlstringrequiredPublicly accessible URL that should receive the events
contactstringrequiredEmail address to be contacted in case of problems with this subscription
topicstringrequiredID of the topic to subscribe to
Responses
201Subscription created
typestringrequiredAllowed:
PUBSUBmethodstringrequiredAllowed:
PUSHnamestringrequiredID of the subscription to be referenced in API calls
pathstringrequiredPath of subscription in project
topicobjectrequiredShow propertiesHide properties
idstringrequirednamestringrequiredpathstringrequiredackDeadlineSecondsintegerrequiredmin -9007199254740991 · max 9007199254740991
retryPolicystring | nullserviceAccountstringrequiredurlstringrequiredPublicly accessible URL that should receive the events
contactstringrequiredEmail address to be contacted in case of problems with this subscription
institutionIdstringrequiredID of the institution the current user belongs to
400Bad Request (invalid input)
messagestringrequirederrorsopenApiErrorItem[]requiredmin items 1
Show propertiesHide properties
Array of
openApiErrorItemopenApiErrorItemtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
401Missing authentication
messagestringrequirederrorsopenApiErrorItem[]requiredmin items 1
Show propertiesHide properties
Array of
openApiErrorItemopenApiErrorItemtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
403Invalid authorization
messagestringrequirederrorsopenApiErrorItem[]requiredmin items 1
Show propertiesHide properties
Array of
openApiErrorItemopenApiErrorItemtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
404Topic for subscription not found
messagestringrequiredtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
413Payload Too Large (JSON body exceeds 400kb limit)
messagestringrequirederrorsopenApiErrorItem[]requiredShow propertiesHide properties
Array of
openApiErrorItemopenApiErrorItemtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
500Internal server error
messagestringrequiredtracestring | nullrequireddeprecatedAlways null. Deprecated; may be removed in a future release.
Request
curl -X POST "/subscriptions" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "PUBSUB",
"method": "PUSH",
"url": "https://example.com/my/webhook/for/this/subscription",
"contact": "my-emergency-and-notifications-contact@ard.de",
"topic": "topic-id-to-subscribe-to"
}'const response = await fetch("/subscriptions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"type": "PUBSUB",
"method": "PUSH",
"url": "https://example.com/my/webhook/for/this/subscription",
"contact": "my-emergency-and-notifications-contact@ard.de",
"topic": "topic-id-to-subscribe-to"
})
});Response
{
"type": "PUBSUB",
"method": "PUSH",
"name": "de.ard.eventhub.subscription.subscription-id",
"path": "projects/ard-eventhub/subscriptions/subscription-name",
"topic": {
"id": "urn:ard:permanent-livestream:topic-id",
"name": "de.ard.eventhub.dev.urn%3Aard%3Apermanent-livestream%3Atopic-id",
"path": "projects/ard-eventhub/topics/topic-name"
},
"ackDeadlineSeconds": 20,
"retryPolicy": null,
"serviceAccount": "name-of-service-account",
"url": "https://example.com/my/webhook/for/this/subscription",
"contact": "my-emergency-and-notifications-contact@ard.de",
"institutionId": "urn:ard:institution:institution-id"
}{
"message": "request.body should have required property 'XYZ'",
"errors": [
null
],
"trace": null
}{
"message": "request.headers should have required property 'Authorization'",
"errors": [
null
],
"trace": null
}{
"message": "user is missing required permission",
"errors": [
null
],
"trace": null
}{
"message": "object 'object.name' not found",
"trace": null
}{
"message": "Payload Too Large",
"errors": [
null
],
"trace": null
}{
"message": "Internal Server Error",
"trace": null
}