Querying Events
The EPCIS Query interfaces allow you to retrieve captured event data from TrackVision using GS1 EPCIS 2.0 compliant query methods.
Query REST API
The EPCIS 2.0 Query REST API provides a standardized way to query for EPCIS events using RESTful endpoints.
Base Query Endpoint
GET https://epcis.yourdomain.trackvision.ai/v2/epcis/events
Replace yourdomain with your actual TrackVision subdomain.
Query Parameters
The Query REST API supports various parameters from the official EPCIS 2.0 query language to filter and retrieve specific events. The table below lists TrackVision's current extent of support. If you need a parameter not currently supported, contact us and it will be added promptly in the next release cycle.
| Parameter | Description | Supported |
|---|---|---|
| eventType | Filters events by their type (e.g., ObjectEvent, AggregationEvent) | Yes |
| GE_eventTime | Filters events with eventTime greater than or equal to a given time | Yes |
| LT_eventTime | Filters events with eventTime less than a given time | Yes |
| GE_recordTime | Filters events with recordTime greater than or equal to a given time | Yes |
| LT_recordTime | Filters events with recordTime less than a given time | Yes |
| EQ_action | Filters events by action (e.g., ADD, DELETE, OBSERVE) | Yes |
| EQ_bizStep | Filters events by business step | Yes |
| EQ_disposition | Filters events by disposition | Yes |
| EQ_persistentDisposition_set | Filters events by set persistent disposition values | Contact us |
| EQ_persistentDisposition_unset | Filters events by unset persistent disposition values | Contact us |
| EQ_quantity | Filters events with quantity equal to specified value | Yes |
| GT_quantity | Filters events with quantity greater than a specified value | Yes |
| GE_quantity | Filters events with quantity greater than or equal to specified value | Yes |
| LT_quantity | Filters events with quantity less than specified value | Yes |
| LE_quantity | Filters events with quantity less than or equal to specified value | Yes |
| EQ_readPoint | Filters events by read point location | Yes |
| WD_readPoint | Filters events with a descendant read point | Contact us |
| EQ_bizLocation | Filters events by business location | Yes |
| WD_bizLocation | Filters events with a descendant business location | Yes |
| EQ_transformationID | Filters transformation events by their transformation ID | Yes |
| MATCH_epc | Filters events that include a specific EPC | Yes |
| MATCH_parentID | Filters events with a specific parent ID | Yes |
| MATCH_inputEPC | Filters transformation events with a specific input EPC | Yes |
| MATCH_outputEPC | Filters transformation events with a specific output EPC | Yes |
| MATCH_anyEPC | Filters events with any matching EPC | Yes |
| MATCH_epcClass | Filters events with a specific EPC class | Yes |
| MATCH_inputEPCClass | Filters transformation events with a specific input EPC class | Yes |
| MATCH_outputEPCClass | Filters transformation events with a specific output EPC class | Yes |
| MATCH_anyEPCClass | Filters events with any matching EPC class | Yes |
| EQ_eventID | Filters events by their unique event ID | Yes |
| EXISTS_errorDeclaration | Filters events based on presence of error declarations | Contact us |
| GE_errorDeclaration_Time | Filters events with error declarations after or on specified time | Contact us |
| LT_errorDeclaration_Time | Filters events with error declarations before specified time | Contact us |
| EQ_errorReason | Filters error declarations by reason code | Contact us |
| EQ_correctiveEventID | Filters error declarations by corrective event ID | Contact us |
| orderBy | Specifies the field to order the results by | Yes |
| orderDirection | Specifies sort direction: ASC or DESC | Yes |
| eventCountLimit | Limits the number of events in the result | Contact us |
| maxEventCount | Maximum number of events to return | Contact us |
| EXISTS_sensorElementList | Filters events with or without sensor data | Contact us |
| GE_time | Filters events with sensor data time field greater or equal to specified value | Contact us |
| LT_time | Filters events with sensor data time field less than specified value | Contact us |
| GE_startTime | Filters events with sensor data startTime greater or equal to specified value | Contact us |
| LT_startTime | Filters events with sensor data startTime less than specified value | Contact us |
| GE_endTime | Filters events with sensor data endTime greater or equal to specified value | Contact us |
| LT_endTime | Filters events with sensor data endTime less than specified value | Contact us |
| EQ_type | Filters events with sensor data sensor report type | Contact us |
| EQ_deviceID | Filters events with sensor data by device ID | Contact us |
| EQ_dataProcessingMethod | Filters by method used for processing sensor data | Contact us |
| EQ_microorganism | Filters sevents with sensor data by microorganism | Contact us |
| EQ_chemicalSubstance | Filters events with sensor data by chemical substance | Contact us |
| EQ_bizRules | Filters events with sensor data by business rules | Contact us |
| EQ_stringValue | Filters events with sensor data by stringValue | Contact us |
| EQ_booleanValue | Filters events with sensor data by boolean value | Contact us |
| EQ_hexBinaryValue | Filters events with sensor data by hexBinary values | Contact us |
| EQ_uriValue | Filters events with sensor data by URI values | Contact us |
| GE_percRank | Filters events with sensor data with percRank greater or equal to specified value | Contact us |
| LT_percRank | Filters events with sensor data with percRank less than specified value | Contact us |
| GT_percRank | Filters events with sensor data with percRank greater than specified value | Contact us |
| LE_percRank | Filters events with sensor data with percRank less or equal to specified value | Contact us |
Example Query
GET https://epcis.customer.trackvision.ai/v2/epcis/events?eventType=ObjectEvent&bizStep=shipping&perPage=50
Authorization: Bearer <your-token>
Query Response
The query response follows the EPCIS 2.0 Query Schema specification:
{
"@context": [
"https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld"
],
"type": "EPCISQueryDocument",
"schemaVersion": "2.0",
"creationDate": "2024-01-15T10:30:00.000Z",
"epcisBody": {
"queryResults": {
"resultsBody": {
"eventList": [
{
"type": "ObjectEvent",
"eventTime": "2024-01-15T10:00:00.000Z",
"eventTimeZoneOffset": "+00:00",
"epcList": [
"urn:epc:id:sgtin:0614141.812345.6789"
],
"action": "OBSERVE",
"bizStep": "shipping",
"readPoint": {
"id": "urn:epc:id:sgln:0614141.00777.0"
}
}
]
}
}
}
}
Reusable Queries
The EPCIS 2.0 standard allows the use of reusable "named" queries that can be saved and re-run over and over again. A named query creates a virtual collection of events (i.e., a view). It has a human-readable name and a query defined using the EPCIS query language.
The result set of an EPCIS events query has the following URL pattern: /queries/{queryName}/events.
A named query is created by specifying the query name, the type of query (EPCIS events or master data) and the query body.
Once a query is created, clients can always retrieve the current set of resources that match the query description.
Creating Reusable Queries
To create a saved query, POST to the queries endpoint with a JSON payload that follows the EPCIS standard. A name is required as is a query object. Example:
POST https://epcis.yourbrand.trackvision.ai/v2/epcis/queries
Content-Type: application/json
Authorization: Bearer <your-token>
{
"name": "UniqueQueryName",
"query": {
"eventType": [
"ObjectEvent"
],
"EQ_bizStep": [
"shipping",
"receiving"
]
}
}
Executing Reusable Queries
To execute a saved query:
GET https://epcis.yourbrand.trackvision.ai/v2/epcis/queries/{queryName}/events
Authorization: Bearer <your-token>
Response is the same as a query response from the REST style endpoint.
Schema Validation
All query responses are validated against the official EPCIS 2.0 Query Schema.
You can use this schema to:
- Validate query responses in your application
- Generate type definitions for strongly-typed languages
Related Documentation
- EPCIS Data Endpoints - Native REST API query documentation
- Capture - Submit EPCIS events
- GS1 EPCIS 2.0 Query Specification - Official query standard