Event stream configuration API (1.0)
Download OpenAPI specification:Download
List registered integrations
Lists all configured integrations.
Authorizations:
Responses
Response samples
- 200
- 500
{- "integrations": [
- {
- "id": "erp-netsuite-integration-001",
- "status": "running",
- "integration_type": "permanent",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}, - {
- "id": "erp-netsuite-integration-002",
- "status": "running",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}, - {
- "id": "sap-integration-001",
- "status": "stopped",
- "integration_type": "temporary",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "ends_at": "2019-02-21T23:59:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}, - {
- "id": "sap-s3-integration-002",
- "status": "stopped",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "s3_parameters": {
- "aws_access_key_id": "some_s3_access_key_id",
- "aws_secret_access_key": "some_s3_secret_key",
- "aws_region": "us-east-1",
- "bucket": "sap_export",
- "key_prefix": "newstore_integration_002"
}
}
]
}
Register new integration
Registers a new integration. 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.
By default, you will receive all the events that NewStore can provide.
To only receive specific events, use the filter_conditions
property
to set filters on entities and/or events. To see all entities and
events, see the entity model.
When you call this method, the integration starts automatically, you do not need to call the Start integration method. At most 10 integrations can be registered.
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 integration that will receive all events that were emitted between the start and end date. When the last event of the end date is emitted, the integration is automatically stopped.
In case of webhook integration, if you use the api_key
property then every call to the URL set in the
callback_url
property includes the line Authorization: Bearer <api_key>
in its header.
In case of S3 integration, the events are stored in multiple files with the following name:
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 integration type can not be modified after creation.
Authorizations:
Request Body schema: application/json
required | object (Webhook Parameters) Configuration parameters for webhook's callback. |
id required | string [ 1 .. 50 ] characters ^[a-z0-9-]+$ The identifier for this integration. It must be a unique value consisting of lowercase alphabetic characters, numbers and dashes. An example would be erp-1. |
integration_type required | string Enum: "temporary" "permanent" Type of the integration. Temporary integrations can not be updated and will be deleted automatically once the last event has been sent. |
starts_at | string <date-time> UTC timestamp from which events are being emitted. Must not be in the future. Optional for permanent integrations and mandatory for temporary integrations. |
ends_at | string <date-time> UTC timestamp until which events are being emitted. Not available for permanent integrations. Mandatory for temporary integrations. |
object or object Configuration parameters for event- and entity-type filtering. |
Responses
Request samples
- Payload
{- "webhook": {
- "id": "erp-netsuite-integration-002",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}, - "aws": {
- "id": "s3-integration-01",
- "integration_type": "temporary",
- "s3_parameters": {
- "aws_access_key_id": "EXAMPLEACCESSKEYID1",
- "aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
- "aws_region": "us-west-2",
- "bucket": "company_bucket",
- "key_prefix": "mycompany-integration-1"
}
}, - "webhookEntityAndEventFilters": {
- "id": "erp-netsuite-integration-002",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}, - "filter_conditions": {
- "event_filter": [
- "order.created",
- "refund_request.issued"
], - "entity_filter": [
- "fulfillment_request",
- "return"
]
}
}, - "webhookEntityFilters": {
- "id": "erp-netsuite-integration-002",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}, - "filter_conditions": {
- "entity_filter": [
- "fulfillment_request",
- "return"
]
}
}, - "webhookEventFilters": {
- "id": "erp-netsuite-integration-002",
- "integration_type": "permanent",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}, - "filter_conditions": {
- "event_filter": [
- "order.created",
- "refund_request.issued"
]
}
}
}
Response samples
- 200
- 400
- 409
- 500
{- "id": "sap-integration-001",
- "status": "running",
- "integration_type": "temporary",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "ends_at": "2019-02-21T23:59:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}
Update the integration
Updates the specified integration and returns the updated state.
Important: Stop the integration before you update it.
The typical update workflow is:
- Stop the integration using the Stop integration method.
- Poll the Get integration method until
status
isstopped
. - Update the integration using the Update integration method.
- Start the integration using the Start integration method.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Request Body schema: application/json
object (Webhook Parameters) Configuration parameters for webhook's callback. | |
object (S3 Parameters) Configuration parameters for upload to amazon s3. | |
object or object Configuration parameters for event- and entity-type filtering. |
Responses
Request samples
- Payload
{- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}
Response samples
- 200
- 400
- 404
- 500
{- "id": "sap-integration-001",
- "status": "running",
- "integration_type": "temporary",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "ends_at": "2019-02-21T23:59:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}
Get integration details
Returns details about an existing integration.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "id": "sap-integration-001",
- "status": "running",
- "integration_type": "temporary",
- "starts_at": "2019-01-17T12:00:00.000Z",
- "ends_at": "2019-02-21T23:59:00.000Z",
- "callback_parameters": {
- "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}
Delete the integration
Deletes an existing integration.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 404
- 500
{- "error_code": "string",
- "message": "string",
- "request_id": "string"
}
Start the integration
Starts the specified integration. NewStore Omnichannel Cloud starts emitting events to the receiving URL.
You can check the status of the integration with the Get integration method.
Note: When an integration was stopped, it must be restarted within 30 days in order to receive all events which occurred while it was stopped. If the integration gets restarted more than 30 days after being stopped, it will only receive events which occurred after the point in time when it was restarted.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "id": "webhook-integration-1",
- "status": "running",
- "integration_type": "permanent",
- "starts_at": "2019-07-07T00:00:00Z"
}
Stop the integration
Stops the specified integration. No events are emitted once the integration is stopped.
You can check the status of the integration with the Get integration method.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "id": "webhook-integration-1",
- "status": "stopped",
- "integration_type": "permanent",
- "starts_at": "2019-07-07T00:00:00Z"
}
Get integration log
Returns the last 50 integration log entries.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "entries": [
- {
- "action": "integration_stopped",
- "reason": "Stopped via API.",
- "created_at": "2019-09-13T08:04:00.000Z"
}, - {
- "action": "retry_triggered",
- "reason": "Request to URL http://example.com/webhook failed. Reason: too many requests (HTTP status code 429). Payload: <payload details>",
- "created_at": "2019-09-12T15:21:00.000Z"
}, - {
- "action": "retry_triggered",
- "reason": "Request to URL http://example.com/webhook failed. Reason: too many requests (HTTP status code 429). Payload: <payload details>",
- "created_at": "2019-09-12T15:20:00.000Z"
}, - {
- "action": "integration_started",
- "reason": "Started via API.",
- "created_at": "2019-09-12T12:00:00.000Z"
}
]
}
List rejected events
Lists the events that were rejected by the integration (HTTP status code 400).
Up to 30 rejected events are stored. To delete some events, use the Delete rejected event method.
Authorizations:
path Parameters
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "rejected_events": [
- {
- "created_at": "2019-09-13T08:04:00.000Z",
- "id": "1a8a5052-8741-4daf-982e-e0a12990335a"
}, - {
- "created_at": "2019-09-13T08:01:00.000Z",
- "id": "045cb397-9dca-4305-81e5-4ad0b6ad242c"
}, - {
- "created_at": "2019-09-13T06:52:00.000Z",
- "id": "c35e7a43-cad2-4f2a-8c54-ad1328373b41"
}
]
}
Get rejected event
Get the payload of the rejected event.
Authorizations:
path Parameters
event_id required | string Unique identifier of the rejected event. |
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 200
- 404
- 500
{- "tenant": "businessname",
- "name": "order.items_cancelled",
- "published_at": "2010-01-01T12:00:00.000Z",
- "payload": {
- "id": "1431b891-c056-4f80-9d34-06479b383417",
- "items": [
- {
- "id": "8c2a657e-e8c7-4f1b-b6d5-ab27d2ec87a1",
- "product_id": "ASDF1000",
- "fulfillment_location_id": "US01"
}, - {
- "id": "9c027c6f-2918-457e-9051-0c6a349701df",
- "product_id": "ASDF1001",
- "fulfillment_location_id": "US01"
}
]
}
}
Delete rejected event
Deletes the rejected event permanently. NewStore stores 30 rejected events so we recommend that you delete the rejected events that you have handled.
To list all the rejected events, use the List rejected events method.
Authorizations:
path Parameters
event_id required | string Unique identifier of the rejected event. |
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 404
- 500
{- "error_code": "string",
- "message": "string",
- "request_id": "string"
}
Retry rejected event
Sends the rejected event to the defined endpoint of the integration again.
In case the integration responded with a 200 response code, the rejected event will be automatically removed from the rejected event list.
Authorizations:
path Parameters
event_id required | string Unique identifier of the rejected event. |
integration_id required | string Unique identifier of the integration. |
Responses
Response samples
- 404
- 500
- 502
{- "error_code": "string",
- "message": "string",
- "request_id": "string"
}