Skip to main content

Creating Subscriptions

POST /api/subscriptions

Request

A subscription can be created by sending a POST request to the /api/subscriptions resource. If a matching subscription already exists (same owning_application, consumer_group, and event_types), that subscription is returned instead of creating a duplicate.

Sample Request

curl -v -X POST "https://TENANT_NAME.mambu.com/api/subscriptions" \
-H "Content-type: application/json" \
-H "Accept: application/vnd.mambu.v2+json" \
-d

Body Parameter

{
"owning_application": "applicationName6",
"consumer_group": "consumerGroup",
"event_types": [
"mrn.event.TENANT_NAME.streamingapi.savings_deposit",
"mrn.event.TENANT_NAME.streamingapi.client_created"
],
"read_from": "end"
}
  • owning_application and event_types are required.
  • consumer_group: The name of the consumer group the subscription is associated with. A consumer group is a set of consumers which cooperate to consume messages from some topics. For more information, see Subscription Cursors.
  • read_from: The position in the stream from where the subscription should start receiving events — begin (the oldest available event) or end (the newest available event). For more information, see Subscription Cursors.
Removed in V2

The initial_cursors parameter and the cursors value for read_from are no longer supported. See Differences Between Streaming API V1 and V2.

Subscription limit

A limit on the total number of subscriptions has been introduced (default 5, configurable to any positive integer on request). A subscription is unique based on the combination of owning_application, consumer_group, and event_types — repeat calls with the same values for these fields don't count against the limit. See Differences Between Streaming API V1 and V2 for the error response when the limit is exceeded.

Response

The response returns the whole subscription object that was created, including the server-generated id field.

Sample Response

{
"id": "8a818e7486a603c40186a603c4010001",
"owning_application": "applicationName6",
"consumer_group": "consumerGroup",
"event_types": [
"mrn.event.TENANT_NAME.streamingapi.savings_deposit",
"mrn.event.TENANT_NAME.streamingapi.client_created"
],
"read_from": "end",
"created_at": "2024-01-15T09:30:00Z",
"updated_at": "2024-01-15T09:30:00Z"
}