Skip to content

louisaxel-ambroise/epcis

Repository files navigation

Last Commit (develop) Codacy Badge Codacy Badge .NET

FasTnT EPCIS is a lightweight GS1 EPCIS 1.2 and 2.0 repository written in C# using .NET8 and backed with EntityFramework Core.

The repository fully supports the following databases:

  • SqlServer (provider: SqlServer)
  • PostGreSQL (provider: Postgres)
  • Sqlite (provider: Sqlite)

Environments and Testing

There is a sandbox available if you want to quickly test this EPCIS repository capabilities.

A Postman team is also available that contains collections for both XML/SOAP and JSON endpoints. Alternatively, a SoapUI project can be found in the source code that contains queries for the v1.2 implementation.

Setup

  1. Download the source code: $ git clone https://www.github.com/louisaxel-ambroise/epcis && cd epcis
  2. Apply database migrations: $ dotnet ef database update --project src/FasTnT.Host --connection "Data Source=fastnt.db;" -- --FasTnT.Database.Provider "Sqlite"
  3. Start the repository: $ dotnet run --project src\FasTnT.Host\FasTnT.Host.csproj --urls "http://localhost:5102/" --connectionStrings:FasTnT.Database "Data Source=fastnt.db;" --FasTnT.Database.Provider "Sqlite"

That's it! You have a properly working EPCIS repository using Sqlite as storage.

You can replace the Connection String and Database Provider with the values that suits better your needs (Sqlite, SqlServer or PostGreSQL).

You can also setup FasTnT EPCIS using the Docker image or in Azure very easily. Check the wiki for more details.

HTTP Endpoints

The API is secured using HTTP Basic auth by default. The users are not stored in the database, but a hash of the authorization value is stored alongside the request. By default the events and masterdata returned in a query are restricted to the ones captured with the same authorization header.

EPCIS 1.2 endpoints:

FasT&T provides a full implementation of the EPCIS 1.2 specification. The endpoints are:

  • Capture: POST /v1_2/Capture
  • Queries : POST /v1_2/Query.svc

Capture endpoint only supports requests with content-type: application/xml or content-type: text/xml header and XML payload.

Queries endpoint supports SOAP requests on endpoint /v1_2/Query.svc.

See the wiki for more details.

Implemented Features

This is the list of implemented 1.2 features in the repository:

  • Capture
    • Events
    • Capture Master Data (CBV)
  • Queries:
    • GetVendorVersion
    • GetStandardVersion
    • GetQueryNames
    • GetSubsciptionIDs
    • Poll
      • SimpleEventQuery
      • SimpleMasterDataQuery
  • Query Callback:
    • CallbackResults
    • CallbackQueryTooLargeException
    • CallbackImplementationException
  • Subscriptions:
    • Subscribe to an EPCIS request
    • Unsubscribe from EPCIS repository
    • Trigger subscriptions that register to specific trigger name
    • Execute subscription based on schedule

EPCIS 2.0 endpoints:

The repository also implements the EPCIS 2.0 specification. The endpoints are:

  • Capture: POST /v2_0/Capture
  • Query : GET /v2_0/events

Capture endpoint supports requests with both content-type: application/xml or content-type: application/json headers and payload.

Queries endpoint supports HTTP requests and supports both accept: application/json and accept: application/xml headers.

The subscriptions will always receive the results in JSON format.

The OpenApi definition of the EPCIS 2.0 endpoints is available at the URL /v2_0/openapi.json. See the wiki for more details.

Implemented Features

This is the list of implemented 2.0 features in the repository:

  • Capture
    • Capture list of Events
    • Capture a single Event
    • Capture CBV masterdata
  • Queries:
    • List events
    • Event pagination
    • Create/Delete a named query
    • Execute a named query
  • Subscriptions:
    • Subscribe to an EPCIS request (webhook)
    • Subscribe to an EPCIS request (websocket)
  • Discovery endpoints
    • EventType discovery endpoint
    • EPCs discovery endpoint
    • Business Steps discovery endpoint
    • Business Locations discovery endpoint
    • Read Points discovery endpoint
    • Dispositions discovery endpoint

Restrictions

  • Only rollback value is accepted for GS1-Capture-Error-Behaviour header
  • Only Never_Translates value is accepted for GS1-EPC-Format header
  • Requests are captured synchronously in the repository

Authors

External contributions on this EPCIS repository are welcome from anyone. This project was created an is primarily maintained by Louis-Axel Ambroise.

License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details

Contact: fastnt@pm.me