Communication Protocol

The EPCIS 2.0 standard defines how traceability data is queried and captured, within a company and between companies. Organizations following the GDST (Global Dialogue on Seafood Traceability) standard implement the EPCIS Query Interface as a REST interface, as defined by EPCIS 2.0 and described concretely by OpenAPI definition file.

The full EPCIS Query Interface is extensive. To keep implementation manageable, the GDST standard requires only a defined subset, described below, together with a GS1 Digital Link resolver for discovery, an authentication mechanism, and the business-to-business exchange workflow.

This article covers four parts:

  1. The EPCIS Query Interface (how data is requested)
  2. The GS1 Digital Resolver (how a repository is discovered)
  3. Authentication (how requests are secured)
  4. The business-to-business data exchange workflow (how it all fits together)

EPCIS Query Interface

The Query Interface follows REST principles. The following method must be implemented.

GET /events

Requests all the events in the repository, or the subset of events matching the criteria supplied as query parameters in the URL.

Responses must be returned in the EPCIS 2.0 JSON-LD format.

Query Parameters

The interface must support the following query parameters, whether used in a named query or directly in the request URL.

Parameter

Description

LT_recordTime

An ISO date-time in UTC (xsd:dateTimeStamp). Returns events whose recordTime is less than the value

GE_recordTime

An ISO date-time in UTC. Returns events whose recordTime is greater than or equal to the value

LT_eventTime

An ISO date-time in UTC. Returns events whose eventTime is less than the value

GE_eventTime

An ISO date-time in UTC. Returns events whose eventTime is greater than or equal to the value

MATCH_anyEPC

A list of URIs. Returns only events that have an epcList, childEPCs, parentID, inputEPCList, or outputEPCList, where one of those EPCs (or parentID) matches one of the supplied URIs

MATCH_anyEPCClass

A list of URIs. Returns only events that have an quantityList, childQuantityList, inputQuantityList, or outputQuantityList, where one of those EPC classes matches one of the supplied patterns or URIs

EQ_bizStep

A list of URIs. Returns only events whose bizStep matches one of the values. If omitted, events are returned regardless of bizStep

EQ_transformationID

A list of URIs. Returns only events whose transformationID matches one of the values. Introduced to improve tracebacks on long-running transformations.

EQ_bizLocation

A list of URIs. Returns only events whose bizLocation matches one of the values. If omitted, events are returned regardless of bizLocation

A query that is too broad to execute (for example, filtering only by event type) may be rejected with a 413 "Query Too Complex" response.

A GS1 Digital Link resolver acts as a lookup service, a kind of "pseudo-DNS", that turns an identifier into links to the information about it. Organizations following the GDST standard must implement a resolver as defined by GS1 Digital Link standard.

Link Type

Description

gs1:epcis

Returns a link to the EPCIS Query Interface for the requested identifier

gs1:masterData

Returns a link that resolves the GS1 Web Vocabulary JSON-LD for the requested GTIN, GLN, or PGLN.

Required Application Identifiers

URL paths use numeric GS1 application identifiers. as of Digital Link 1.1.3, the numeric identifier must be used, the alphabetic from (e.g. gtin) is no longer allowed, so a URL uses 01 before a GTIN, not gtin.

Application Identifier

Meaning

00

Serialized Shipping Container Code (SSCC)

01

Product definition identifier (GTIN)

414

Location Identifier (GLN)

417

Party location identifier (PGLN)

21

Serial Number

10

Lot Number

URL Structure

A Digital Link URL is built as {Base URL}/{Application Identifier}/{Value}/{Application Identifier 2}/{Value 2} , with the application identifiers in a specific order. For example:

https://resolver.example.org/01/00860003130308/10/LOT07082021

The supported application-identifier pairs are:

Pair

Returns

00

Links about an SSCC or LPN (link to an EPCIS Query Interface via gs1:epcis

417

Links about a trading party or organization (queryable with gs1:masterData or gs1:epcis)

414

Links about a location (queryable with gs1:masterData or gs1:epcis)

01/10

Links about a specific batch/lot of a trade item (link to an EPCIS Query Interface, via gs1:epcis)

01/21

Links about an individual instance of a trade item (link to an EPCIS Query Interface, via gs1:epcis)

To resolve a Digital Link URI, replace the canonical base URL, with the base URL of the sender´s resolver. For example, a PGLN identifier https://id.gs1.org/417/0860003130308 resolved against a sender´s resolver https://resolver.example.org/ becomes:

Example Request

GET /417/0860003130308?linkType=linkset HTTP/1.1
          Host: https://resolver.example.org
          X-API-KEY: <api-key>
          https://resolver.example.org/417/0860003130308

Example Response

{
              "linkset": [
                  {
                      "anchor": "https://resolver.example.org/digitallink/01/urn:gdst:example.org:product:class:system.processedfish",
                      "itemDescription": null,
                      "https://ref.gs1.org/voc/defaultLink": [
                          {
                              "href": "https://resolver.example.org/masterdata/product/urn:gdst:example.org:product:class:system.processedfish",
                              "title": "Default Master Data"
                          }
                      ],
                      "https://ref.gs1.org/voc/masterData": [
                          {
                              "href": "https://resolver.example.org/masterdata/product/urn:gdst:example.org:product:class:system.processedfish",
                              "title": "Master Data"
                          }
                      ],
                      "https://ref.gs1.org/voc/epcis": [
                          {
                              "href": "https://resolver.example.org/epcis",
                              "title": "EPCIS Repository"
                          }
                      ]
                  }
              ]
          }
Digital link resolvers are based on the Resolver standard published by GS1.
Resolver Responses

The digital link resolver is

Authentication

The two parties exchanging data exchange API keys to access each other´s EPCIS Query Interface. Each request from the receiver to the sender carries the key in an HTTP header:

X-API-Key: 81C6C194-B445-4FFB-907E-CDBC7FF7F36F

Authentication is not required by EPCIS 2.0 standard, but it expected to occur. At a minimum, implementations following the GDST standard must support the X-API-Key header. If both providers support another security protocol and prefer it, they use it instead, the standard only mandates that X-API-Key is supported.

It is entirely up to sender to manage, generate, and authenticate API keys, the standard only specifies where to place and look for the key. Some cases may not require authentication at all, for example, a brand owner exposing public (or redacted) traceability data to consumers, or sharing trade-item information such as coupons or recipes through their resolver.

Business-to-Business Data Exchange

In a B2B exchange, the Receiver is the party requesting traceability data and the Sender is the party providing it (typically the Receiver is receiving goods, and the Sender is transferring them).

Before exchanging traceability data, the two parties first exchange company information to establish each other in their systems. The GDST proposes sharing at minimum:

  • A GS1 Digital Link URI plus the party´s GLN, and
  • an API key

This lets each party request the master data describing a party or location (not just an object).

Once established, typical exchange runs as follows: The Receiver takes a product identifier (often obtained from an earlier step, such as an Advanced Shipment Notification through an ERP system), formats it as a GS1 Digital Link URI, and queries the Sender´s Digital Link resolver to discover the location of Sender´s EPCIS repository. The Receiver then queries that EPCIS Query Interface to obtain the events and master data for the products. All requests use HTTP following REST, and responses are returned in EPCIS 2.0 JSON-LD format.


How did we do?

Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)