Event stream API (1.0)
Download OpenAPI specification:Download
Eventstream API
Get information about publication attempts for a given subscription.
Get information about published events or events that failed to be published to a tenant's event stream subscriptions.
Authorizations:
path Parameters
subscription_id required | string Unique identifier of the subscription. |
query Parameters
from | string <date-time> Example: from=2022-12-31T23:59:59Z Only return events which were attempted to be published after this date. |
to | string <date-time> Example: to=2023-02-01T09:12:23Z Only return events which were attempted to be published before this date. |
event_name | string Example: event_name=order.created The name of an event stream event. |
status | string Example: status=success The status of the publishing attempt (either 'success' or 'failure'). |
domain_entity_id | string Example: domain_entity_id=f47ac10b-58cc-4372-a567-0e02b2c3d479 The ID of a domain entity, for example an order ID. |
domain_entity_type | string Example: domain_entity_type=order The name of a domain entity, for example 'order' or 'fulfillment_request'. |
Responses
Response samples
- 200
- 401
- 403
- 500
- default
{- "events": [
- {
- "subscription_type": "permanent",
- "target": "webhook",
- "status": "SUCCESS",
- "attempted_at": "2023-01-13T00:59:59.718Z",
- "retries_remaining": 10,
- "entity_id": "c01234c4-6543-4ea0-8900-63e26b4faf12",
- "domain_entity_id": "e01234c4-6543-4ea0-0001-63e26b4faf45",
- "domain_entity_type": "order",
- "event_name": "fulfillment_request.assigned",
- "response_time_ms": 123
}, - {
- "subscription_type": "permanent",
- "target": "webhook",
- "status": "FAILURE",
- "attempted_at": "2023-01-15T01:59:59.756Z",
- "retries_remaining": 9,
- "entity_id": "e01234c4-6543-4ea0-0001-63e26b4faf45",
- "domain_entity_id": "e01234c4-6543-4ea0-0001-63e26b4faf45",
- "domain_entity_type": "order",
- "event_name": "order.created",
- "response": {
- "body": "Temporary unavailable due to maintenance.",
- "code": 503
}, - "response_time_ms": 123
}, - {
- "subscription_type": "permanent",
- "target": "s3",
- "status": "FAILURE",
- "attempted_at": "2023-01-15T01:59:59.618Z",
- "retries_remaining": 0,
- "entity_id": "d21234c4-6543-4ea0-1234-63e26b4faf13",
- "domain_entity_id": "e01234c4-6543-4ea0-0001-63e26b4faf45",
- "domain_entity_type": "order",
- "event_name": "invoice.created",
- "filename": "/tmp/dodici-demo_s3-export-0015033518640050790148/1773479406750-data-1234a.export",
- "response": {
- "body": "Invalid access credentials.",
- "code": 403
}
}, - {
- "subscription_type": "temporary",
- "target": "s3",
- "status": "SUCCESS",
- "attempted_at": "2023-02-07T10:19:53.214Z",
- "retries_remaining": 10,
- "entity_id": "b01234c4-6543-4ea0-5678-63e26b4faf14",
- "domain_entity_id": "b01234c4-6543-4ea0-5678-63e26b4faf14",
- "domain_entity_type": "order",
- "event_name": "payment_account.amount_captured",
- "filename": "/tmp/dodici-demo_s3-export-002-temp7033518640050790148/1773479406751-data-4567b.export"
}, - {
- "subscription_type": "permanent",
- "target": "webhook",
- "status": "SUCCESS",
- "attempted_at": "2023-08-16T00:59:59.718Z",
- "retries_remaining": 10,
- "entity_id": "d01234e4-6543-4ea0-1234-63e26b4faf88",
- "domain_entity_id": "d01234e4-6543-4ea0-1234-63e26b4faf88",
- "domain_entity_type": "customer",
- "event_name": "customer.created",
- "response_time_ms": 99
}
]
}
Retry event publication
Will attempt to re-publish the selected publication attempt into the target system. Based on the outcome of the attempt a new entry will be posted into the event-publications showing the outcome of the action.
Authorizations:
path Parameters
publication_id required | string Unique identifier of the publication. |
subscription_id required | string Unique identifier of the subscription. |
Responses
Response samples
- 401
- 403
- 404
- 409
- 500
- default
{- "detail": "string",
- "instance": "../dictionary",
- "request_id": "string",
- "status": 100,
- "title": "string",
- "type": "about:blank"
}
Response samples
- 200
- 401
- 403
- 500
- default
{- "subscriptions": [
- {
- "id": "sample-webhook-123",
- "subscription_type": "PERMANENT",
- "status": "RUNNING",
- "starts_at": "2024-05-01T20:02:00Z",
- "parameters": {
- "webhook": {
- "api_key": "2f61d887-cec0-4547-aa91-25854bc7ba9b"
}
}
}, - {
- "id": "sample-webhook-filters-123",
- "subscription_type": "PERMANENT",
- "status": "RUNNING",
- "starts_at": "2024-05-01T20:02:00Z",
- "event_types": [
- "application/vnd.newstore.events.order.created+json;version=1",
- "application/vnd.newstore.events.fulfillment_request.assigned+json;version=1",
- "application/vnd.newstore.events.return.processed+json;version=1"
],
}, - {
- "id": "sample-webhook-temporary-123",
- "subscription_type": "TEMPORARY",
- "status": "COMPLETED",
- "starts_at": "2024-05-01T20:02:00Z",
- "ends_at": "2024-05-10T00:02:00Z",
}, - {
- "id": "sample-s3-123",
- "subscription_type": "PERMANENT",
- "status": "RUNNING",
- "starts_at": "2024-05-01T20:02:00Z",
- "parameters": {
- "s3": {
- "aws_region": "us-east-1",
- "bucket": "my-bucket-name",
- "key_prefix": "myproject/events"
}
}
}
]
}
Create a new subscription
Registers a new subscription. You can specify how the events will be sent to you:
- via the webhook. The events are provided in real time.
- via file upload to the S3 bucket of your choice. An upload typically occurs every 5 minutes.
The subscription will receive all events listed in the
event_types
property. To get a full list of available events refer to the/event-types
endpoint. The created subscription will be started automatically. At most 25 subscriptions can be registered (including temporary and stopped subscriptions). You can also use this method to replay events by date. To do this, set a start and end date when you call this method. The use of an end date registers a temporary subscription which will receive all events that were created between the start- and end date. After the last event before the end date is published, the subscription is automatically stopped. You can then use the Delete subscription method to delete the temporary subscription. Be aware that deleting the subscription will also remove its logs and rejected events. In case of webhook subscription, if you use theapi_key
property then every call to the URL set in thecallback_url
property includes the lineAuthorization: Bearer <api_key>
in its header. In case of S3 subscription, the events are stored in files with the following format:s3://{bucket}/{key_prefix}/{tenant}/{timestamp}-data-{random_string}.export
, where: bucket
andkey_prefix
are the parameters you specified ins3_parameters
.timestamp
is the time, when the file was created on the server, in epoch millis. Every file contains multiple JSON objects, one per event, delimited by a newline character. The events are described with the same schema as in the webhook. A new file is started every 5 minutes, or when the size of the current file reaches 50 MiB, whichever happens first. Note: The start and end date as well as subscription type can not be modified after creation.
Authorizations:
Request Body schema: application/json
id required | string [ 1 .. 50 ] characters ^[a-z0-9-]+$ The identifier for this subscription. It must be a unique value consisting of lowercase alphabetic characters, numbers and dashes. An example would be erp-1. |
subscription_type required | string Enum: "PERMANENT" "TEMPORARY" Type of the subscription. Temporary subscriptions can not be updated and will be stopped automatically once the last event has been sent. |
notification_url | string <url> Endpoint that will receive notifications about the subscriptions lifecycle changes. |
starts_at | string <date-time> UTC timestamp from which events are being emitted. Must not be in the future. Optional for permanent subscriptions and mandatory for temporary subscriptions. |
ends_at | string <date-time> UTC timestamp until which events are being emitted. Not available for permanent subscriptions. Mandatory for temporary subscriptions. |
event_types required | Array of strings non-empty A list of events to listen to (e.g. order.created, order.completed, return.processed). At least 1 event type is required. |
required | object or object |
Responses
Request samples
- Payload
Create a webhook subscription
{- "id": "webhook-subscription-123",
- "subscription_type": "TEMPORARY",
- "starts_at": "2024-05-01T00:00:00Z",
- "ends_at": "2024-05-02T00:00:00Z",
- "event_types": [
- "application/vnd.newstore.events.order.created+json;version=1",
- "application/vnd.newstore.events.fulfillment_request.items_completed+json;version=1"
], - "parameters": {
- "webhook": {
- "api_key": "2f61d887-cec0-4547-aa91-25854bc7ba9b"
}
}
}
Response samples
- 400
- 409
- 500
- default
{- "detail": "string",
- "instance": "../dictionary",
- "request_id": "string",
- "status": 100,
- "title": "string",
- "type": "about:blank"
}
Updates the subscription
Modify the subscription. Can be used to start or stop an existing subscription.
Authorizations:
path Parameters
subscription_id required | string Unique identifier of the subscription. |
Request Body schema: application/json
status required | string Enum: "RUNNING" "STOPPED" "COMPLETED" "FAILED" "INITIALIZING" Status of the subscription. Newly added subscriptions will start automatically. |
Responses
Request samples
- Payload
{- "status": "STOPPED"
}
Response samples
- 400
- 404
- 500
- default
{- "detail": "string",
- "instance": "../dictionary",
- "request_id": "string",
- "status": 100,
- "title": "string",
- "type": "about:blank"
}
Get subscriptions details
Returns details about an existing subscription.
Authorizations:
path Parameters
subscription_id required | string Unique identifier of the subscription. |
Responses
Response samples
- 200
- 404
- 500
- default
{- "id": "sample-webhook-filters-123",
- "subscription_type": "TEMPORARY",
- "status": "INITIALIZING",
- "starts_at": "2024-05-01T20:02:00Z",
- "ends_at": "2024-05-02T20:02:00Z",
- "event_types": [
- "application/vnd.newstore.events.order.created+json;version=1",
- "application/vnd.newstore.events.fulfillment_request.assigned+json;version=1",
- "application/vnd.newstore.events.return.processed+json;version=1"
],
}
Delete the subscription.
Delete an existing subscription.
Authorizations:
path Parameters
subscription_id required | string Unique identifier of the subscription. |
Responses
Response samples
- 401
- 403
- 404
- 500
- default
{- "detail": "string",
- "instance": "../dictionary",
- "request_id": "string",
- "status": 100,
- "title": "string",
- "type": "about:blank"
}
Get subscription log
Return the last 50 subscription log entries.
Authorizations:
path Parameters
subscription_id required | string Unique identifier of the subscription. |
Responses
Response samples
- 200
- 401
- 403
- 404
- 500
- default
{- "logs": [
- {
- "action": "integration_stopped",
- "reason": "Stopped via API.",
- "created_at": "2024-04-26T12:19:00Z",
- "event_id": "55169f93-d790-4780-8f4e-02329144cf06",
- "payload": "{\"tenant\": \"example\", \"name\": \"fulfillment_request.items_failed\", \"published_at\": \"2024-04-26T12:18:17.729Z\", \"payload\": {\"id\": \"448a142d-94f0-4e5d-8cbc-12a38d341fe7\", \"order_id\": \"fb821ea5-f1b5-50cf-85b5-3ca18f205a2b\", \"logical_timestamp\": 123, \"fulfillment_location_id\": \"ABC\", \"service_level\": \"2_DAY\", \"items\": [{\"id\": \"776c3344-f747-4e62-9c3e-049aeab276d2\", \"product_id\": \"123\", \"rejection_reason\": \"cannot_fulfill\"}]}}"
}, - {
- "action": "retry_triggered",
- "reason": "Request to URL http://example.com/webhook failed. Reason: too many requests (HTTP status code 429).",
- "created_at": "2024-04-25T10:21:00Z",
- "event_id": "55169f93-d790-4780-8f4e-02329144cf06",
- "payload": "{\"tenant\": \"example\", \"name\": \"fulfillment_request.items_failed\", \"published_at\": \"2024-04-25T10:18:17.729Z\", \"payload\": {\"id\": \"558a142d-94f0-4e5d-8cbc-12a38d341fe7\", \"order_id\": \"fb821ea5-f1b5-50cf-85b5-3ca18f205a2b\", \"logical_timestamp\": 123, \"fulfillment_location_id\": \"ABC\", \"service_level\": \"2_DAY\", \"items\": [{\"id\": \"776c3344-f747-4e62-9c3e-049aeab276d2\", \"product_id\": \"123\", \"rejection_reason\": \"cannot_fulfill\"}]}}"
}, - {
- "action": "integration_started",
- "reason": "Started via API.",
- "created_at": "2019-09-12T12:00:00Z"
}
]
}
List events that can be subscribed to.
Lists all subscribeable events.
Authorizations:
Responses
Response samples
- 200
- 401
- 403
- 500
- default
{- "event_types": [
- {
- "event_name": "order.created",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.order.created+json;version=1"
}, - {
- "event_name": "order.opened",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.order.opened+json;version=1"
}, - {
- "event_name": "order.completed",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.order.completed+json;version=1"
}, - {
- "event_name": "order.items_cancelled",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.order.items_cancelled+json;version=1"
}, - {
- "event_name": "refund_request.issued",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.refund_request.issued+json;version=1"
}, - {
- "event_name": "fulfillment_request.items_ready_for_handover",
- "event_version": 1,
- "event_type": "application/vnd.newstore.events.fulfillment_request.items_ready_for_handover+json;version=1"
}
]
}