Fluent Commerce Logo
Docs

Using the Event API

Essential knowledge

Author:

Movyn John

Changed on:

13 Dec 2023

Overview

Using the Event API

Key points

  • Retrieving Orchestration and Orchestration Audit events are done via the Fluent Event API
  • The Event API has various parameters that are available to filter for specific events, for example for a particular entity or during a particular timeframe.

Event API Parameters

Parameter NameDescriptionValues
context.rootEntityTypeThe root entity which is able to be orchestrated.
  • ORDER
  • LOCATION
  • FULFILMENT_OPTIONS
  • PRODUCT_CATALOGUE
  • INVENTORY_CATALOGUE
  • VIRTUAL_CATALOGUE
  • CONTROL_GROUP
  • RETURN_ORDER
  • BILLING_ACCOUNT
  • JOB
context.rootEntityIdThe root entity ID.Example: 17
context.rootEntityRefThe root entity reference.Example: HD_123
context.entityIdThe entity ID.Examples: 16
context.entityRefThe entity reference.Example: c766dd91-a9a8-11ec-989e-69dadf16f9ea
context.entityTypeThe entity type which is able to be orchestrated.
  • ORDER
  • FULFILMENT
  • ARTICLE
  • CONSIGNMENT
  • LOCATION
  • WAVE
  • FULFILMENT_OPTIONS
  • FULFILMENT_PLAN
  • PRODUCT_CATALOGUE
  • CATEGORY
  • PRODUCT
  • INVENTORY_CATALOGUE
  • INVENTORY_POSITION
  • INVENTORY_QUANTITY
  • VIRTUAL_CATALOGUE
  • VIRTUAL_POSITION
  • CONTROL_GROUP
  • CONTROL
  • RETURN_ORDER
  • RETURN_FULFILMENT
  • BILLING_ACCOUNT
  • CREDIT_MEMO
  • BATCH
fromThe From DateTime represented as a UTC ISO String. The format of this string is as follows: 'YYY-MM-DDTHH:mm:ss.ssZ'Note: By default, if this parameter is not present in the API query, then only the past 30 days are consideredExample: 2023-03-06T01:05:45.00Z
toThe To DateTime represented as a UTC ISO String. The format of this string is as follows: 'YYY-MM-DDTHH:mm:ss.ssZ'Example: 2023-03-06T01:05:45.00Z
nameThe name of the event / ruleset.Example: CheckOrderCoordinates
categoryThe category of the event.
  • snapshot
  • ruleSet
  • rule
  • ACTION
  • CUSTOM
  • exception
  • ORDER_WORKFLOW
retailerIdThe ID of the retailer the event is specified for.Example: 1
eventTypeThe type of event.
  • ORCHESTRATION
  • ORCHESTRATION_AUDIT
  • API
  • INTEGRATION
  • SECURITY
  • GENERAL
eventStatusThe status of the event.
  • PENDING
  • SCHEDULED
  • NO_MATCH
  • SUCCESS
  • FAILED
  • COMPLETE
startThe index to start at, which is used for paginating through the API response. The response will have a `hasMore` field indicating if more events are present.Example: 100
countThe number of results per page to be returned in the API response. The recommendation is to not retrieve more than 5000 events in a single request. Doing so may result in a timeout of the API due to the number of records having to be returned.Note: By default if this parameter is not present in the API query, only the first 100 events will be returned.

Examples

Below are various examples on how to filter events using the Event API.
  • Orchestration Events for a root entity by id. (e.g. rootEntityType=ORDER, rootEntityId=123)

    `{{fluentApiHost}}/api/v4.1/event?context.rootEntityType={{rootEntityType}}&context.rootEntityId={{rootEntityId}}&eventType=ORCHESTRATION`  
  • Audit Events for a specific entity by id. (e.g. entityType=FULFILMENT, entityId=123)

    `{{fluentApiHost}}/api/v4.1/event?context.entityType={{entityType}}&context.entityId={{entityId}}&eventType=ORCHESTRATION_AUDIT`  
  • Orchestration and Audit Events for a root entity by ref. (e.g. rootEntityRef=LOC_1, rootEntityType=LOCATION)

    `{{fluentApiHost}}/api/v4.1/event?context.rootEntityRef={{rootEntityRef}}&context.rootEntityType={{rootEntityType}}`  
  • Orchestration and Audit Events for an entity with id, count and from/to dates defined - 5min timeframe (e.g. entityId=123, entityType=ORDER, count=5000, from=2019-01-01T00:00:00.000Z, to=2019-01-01T00:05:00.000Z)

    `{{fluentApiHost}}/api/v4.1/event?context.entityId={{entityId}}&context.entityType={{entityType}}&count={{count}}&from={{from}}&to={{to}}`  
  • Audit Events events for an entity with entityId and rootEntityRef specified (e.g. rootEntityRef=LOC_1, rootEntityType=LOCATION, entityId=123, entityType=WAVE)

    `{{fluentApiHost}}/api/v4.1/event?eventType=ORCHESTRATION_AUDIT&context.rootEntityRef={{rootEntityRef}}&context.rootEntityType={{rootEntityType}}&context.entityId={{entityId}}&context.entityType={{entityType}}`  
  • Exception events in a timeframe (e.g. from=2020-01-01T00:00:00.000Z, to=2020-01-01T23:59:59.999Z, count=5000)

    `{{fluentApiHost}}/api/v4.1/event?category=exception&from={{from}}&to={{to}}&count={{count}}`  
  • Webhook action events for an entity  (e.g. rootEntityRef=HD_123, rootEntityType=ORDER)

    `{{fluentApiHost}}/api/v4.1/event?eventType=ORCHESTRATION_AUDIT&context.rootEntityRef={{rootEntityRef}}&context.rootEntityType={{rootEntityType}}&category=ACTION&name=Send Webhook`  
  • Rest API events (legacy)

    `{{fluentApiHost}}/api/v4.1/event?eventType=API&name=POST /api/v4.1/order&count=5000`   `{{fluentApiHost}}/api/v4.1/event?eventType=API&name=PUT /api/v4.1/workflow&count=5000`  
  • Event by id

    `{{fluentApiHost}}/api/v4.1/event?query={{eventId}}`  
  • Log Action events with count and from/to parameters (e.g. from=2020-01-01T00:00:00.000Z, to=2020-01-01T00:15:00.000Z, count=5000)

    `{{fluentApiHost}}/api/v4.1/event?category=CUSTOM&from={{from}}&to={{to}}&count={{count}}`