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 endpoints:

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

  • Capture: POST /Capture
  • Query : GET /events
  • SOAP Service : POST /Query.svc

Capture and Query endpoints supports requests with content-type: application/json (EPCIS v2.0), content-type: application/xml or content-type: text/xml header and JSON or XML payload.

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

See the wiki for more details.

Implemented Features

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

  • Capture
    • Capture a list of Events
    • Capture a single Event
    • Capture Master Data (CBV)
  • Queries:
    • List events
    • Event pagination
    • Create/Delete a named query
    • Execute a named query
  • Soap Queries:
    • GetVendorVersion
    • GetStandardVersion
    • GetQueryNames
    • GetSubsciptionIDs
    • Poll
      • SimpleEventQuery
      • SimpleMasterDataQuery
  • Subscriptions:
    • Subscribe to an EPCIS request (webhook)
    • Subscribe to an EPCIS request (websocket)
    • Trigger subscriptions that register to specific trigger name
    • Execute subscription based on schedule
  • Discovery endpoints
    • EventType discovery endpoint
    • EPCs discovery endpoint
    • Business Steps discovery endpoint
    • Business Locations discovery endpoint
    • Read Points discovery endpoint
    • Dispositions discovery endpoint
  • Query Callback:
    • CallbackResults
    • CallbackQueryTooLargeException
    • CallbackImplementationException

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

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