Skip to main content

Creating Subscriptions

POST /subscriptions

Request

A subscription can be created by sending a POST request to the /api/v1/subscriptions resource.

Sample Request

curl -v -X POST "https://TENANT_NAME.mambu.com/api/v1/subscriptions" -H "Content-type: application/json" -d

Body Parameter

{
"owning_application": "demo-app",
"event_types": ["mrn.event.TENANT_NAME.streamingapi.client_approved","mrn.event.TENANT_NAME.streamingapi.client_rejected"],
"consumer_group": "default",
"read_from": "end"
}

The consumer_group and read_from fields are optional.

  • 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. The default value is default. For more information, see Subscription Cursors.
  • read_from: The position in the stream from where the subscription should start receiving events. It can be begin (the oldest available event) or end (the newest available event). The default value is end. For more information, see Subscription Cursors.

Response

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

Sample Response

{
"owning_application": "demo-app",
"event_types": [
"mrn.event.TENANT_NAME.streamingapi.client_approved"
],
"consumer_group": "default",
"read_from": "end",
"id": "0691160a-b519-4595-b85c-a400fc73e963",
"created_at": "2018-11-18T22:27:29.156Z"
}