- Table of contents
- What is this backend app responsible for?
- Services Available
- Open API specification
- Detailed API Services
- OSS License Check
- Swagger Docs
- Run the application
- TL;DR
- License
This backend includes the services and logics to manage the passports of the frontend app
.
All Authenticated APIs required a AccessToken
JWT Token generated by the login in the frontend or in the Catena-X Keycloak instance.
{
headers: {
Authorization: "Bearer <<AccessToken>>"
}
}
For login and log out!
------
/auth/check #With this api you can check you authentication status.
------
/auth/token #Request token from the keycloak instance
------
/auth/userInfo #With this api you can get your user information.
------
The Digital Product Pass Open API specification is available at the swagger hub from Tractus-X:
https://app.swaggerhub.com/apis/eclipse-tractusx-bot/digital-product-pass
The APIs below are the ones contain in the Digital Product Pass Backend
reference implementation. Which can be reused for retrieving aspects from the Catena-X Network.
API | Method | Description | Parameters |
---|---|---|---|
/api/contract/create | POST | The /api/contract/create api is responsible for calling the BPN Discovery service searching for the BPN of a manufacturerPartId and validating if there is any Decentral Digital Twin Registry available for the BPN number found in the EDC Discovery service. |
Go to Params |
/api/contract/search | POST | At the /api/contract/search API the user can search for a serialized Id and get its contract. The Backend will search for the Digital Twin and will return the contract for the first one that is found. A sign token (a sha256 hash) is return also and acts like a "session token" allowing just the user that created the process to sign or decline the contract. |
Go to Params |
/api/contract/agree | POST | Once the user has the contract he can call the /api/contract/agree API to start the negotiation process and the transfer of the passport. This means that the user accepted the policy and the frame-contracts contained in the contract policy. |
Go to Params |
/api/contract/decline | POST | The other option rather than /agree is the /decline API, that basically blocks the process and makes it invalid. This means that the user declined the specific contract that was found for this process. |
Go to Params |
/api/contract/cancel | POST | The user can use /cancel to interrupt the negotiation process once it is signed by mistake if is the case. It will be only valid until the negotiation is made. |
Go to Params |
/api/contract/status/<processId> |
GET | After the user signs the contract he can use the /status API to get the process status and see when it is ready to retrieve the passport using the API /data .. |
Go to Params |
/api/data | POST | The API /data will decrypt the passport file that is encrypted using the session token "sign token", and will delete the file so that it is returned just once to the user and can not be accessed anymore. So a new passport will be always need to be requested.. |
Go to Params |
/api/data/request | POST | The Single API /data/request calls the necessary above APIs in order to retrieve the passport with auto-sign capability, it calls the create API, then search API, signs with the agree API and retrieves the data with the data API. The authentication is done with an API Key received as an HTTP header. |
Go to Params |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
id | searchIdValue | [REQUIRED] |
type | searchIdTypeName | manufacturerPartId |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
id | serializedIdValue | [REQUIRED] |
idType | serializedIdTypeName | partInstanceId |
processId | processIdentification | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
processId | processIdentification | [REQUIRED] |
contractId | contractIdentification | [REQUIRED] |
policyId | policyIdentification | If no policyId is specified then the first policy of the contract will be taken |
token | searchSessionToken | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
processId | processIdentification | [REQUIRED] |
token | searchSessionToken | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
processId | processIdentification | [REQUIRED] |
contractId | contractIdentification | [REQUIRED] |
token | searchSessionToken | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
processId | processIdentification | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
processId | processIdentification | [REQUIRED] |
contractId | contractIdentification | [REQUIRED] |
token | searchSessionToken | [REQUIRED] |
Parameter | Value Name | Mandatory or Optional Value |
---|---|---|
id | searchIdValue | [REQUIRED] |
idType | searchIdTypeName | manufacturerPartId |
discoveryId | serializedIdValue | [REQUIRED] |
discoveryIdType | serializedIdTypeName | partInstanceId |
children | searchForChildren | true/false |
semanticId | semanticIdentification | semanticId |
NOTE: You must be authenticated with the keycloak instance to access this APIs
Get data from a Catena-X Provider by using its processId, contractId and a token, this retrieves product passport after a successful negotiation.
/api/data #Returns the data negotiated and transferred
{
"processId": "string",
"contractId": "string",
"token": "string",
"policyId": "optional:string"
}
The Single API permits to get data from a Catena-X Provider by abstracting of all the needed APIs to do so. Authenticating with an API Key and with the given id and discoveryId, this API will create the process and check for the viability of the data retrieval, searches for a passport with the given id, automatically signs the contract retrieved from provider and start negotiation, waits for the negotiation to be done and returns the data negotiated and transferred.
/api/data/request #Creates the process, searchs for a passport with the following id, negotiates and signes the contract, returns the data negotiated and transferred.
{
"id": "string",
"idType": "optional:string",
"discoveryId": "string",
"discoveryIdType": "optional:string",
"children": "optional:boolean",
"semanticId": "optional:string"
}
/api/contract/create #Creates a process and checks for the viability of the data retrieval
{
"id": "string",
"type": "string"
}
/api/contract/search #Searches for a passport with the following id
{
"processId": "string",
"id": "string",
"children": true // Optional Boolean
"idType": "optional:string",
"dtIndex": 0, //Optional Integer
"idShort": "optional:string"
}
/api/contract/agree #Sign contract retrieved from provider and start negotiation
{
"processId": "string",
"contractId": "string",
"token": "string",
"policyId": "optional:string"
}
/api/contract/decline #Decline passport negotiation
{
"processId": "string",
"token": "string"
}
/api/contract/cancel #Cancel the negotiation
{
"processId": "string",
"contractId": "string",
"token": "string",
"policyId": "optional:string"
}
/api/contract/status/<processId> #Get status from process
/api/irs/<processId>/<searchId> #Endpoint called by the IRS to set status completed
- Id
- State
/api/irs/<processId>/tree #Api called by the frontend to obtain the tree of components
/api/irs/<processId>/state #Api called by the frontend to check if the process is finished
/api/irs/<processId>/components #Api called by the frontend to obtain the list of components of the tree
Public APIs don't require authentication
/health #Get the health status of the server
{
"message": "RUNNING",
"status": 200,
"data": "24/11/2022 17:48:18.487"
}
/endpoint/<processId> #Receives the EDR from the EDC Consumer and get the passport json
/endpoint/<processId>/<endpointId> #Receives the EDR for the EDC Consumer and queries for the dDTR
The third party library dependecies, utilized in this app have to be approved from The Eclipse Foundation.
The Dash Licence Tool is used to scan the dependencies
OSS License Checks with Dash & Compliance with Apache 2.0
At the time of writing this manual, the dependencies have status approved and therefore no need to generate IP Team Review request further.
Maven plugin used to check OSS license
How to run:
mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES
Swagger documentation is now automatically available at the following path:
https://<host>/swagger-ui/index.html
For authorization, you will need to add a JWT Access token from the Catena-X IAM:
Use maven to run the spring boot application:
mvn spring-boot:run
If you want to run the application in a different way checkout the frequently asked questions section below.
You can use the default configuration to start the application:
charts/digital-product-pass/values.yaml
However if you need to change it just create a new environment with this naming convention: values-env`.yaml
where env
is the name of your environment. You can use as an example the following configuration file: charts/digital-product-pass/values-int.yaml
.
The configuration for the consumer backend application is a yaml file that is configured in the following tag: backend.application
. Before the application starts all the configuration parameters must be specified, since they are required for initialization and will be checked at the test fase.
Once you configured the application use the follow the TL;DR below to build the image and start the application
using helm charts.
Find more documentation on how to install the backend in the INSTALL.md file.