Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/usage/bruno/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# API Requests for Data Exchange

This document provides information about API requests for the Data Exchange.

## Roles
- Data Consumer - Alice
- Data Provider - Bob

## Bruno

The Bruno collection contains all the data exchange flow between Alice and Bob.

### Setting Up Bruno

[Download](https://www.usebruno.com/downloads) Bruno client suitable for your operating system

### Import Collection

- Open the following [Collection](./constructx-edc) in Bruno using the dots at the left top corner.


![collection-import](media/open-collection.png)

### Import Envrionments

Once the collection is imported, import the [Environment](./environments.json) at the top right corner,

![environment-import](./media/import-environment.png)


The collection is adopted from [Eclipse-TractusX Umbrella - API Testing](https://github.com/eclipse-tractusx/tractus-x-umbrella/tree/release-25.09/docs/api)

## NOTICE

This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).

* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024 Contributors to the Eclipse Foundation
* Source URL: <https://github.com/eclipse-tractusx/tractus-x-umbrella>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
meta {
name: 01-Create The Data
type: http
seq: 1
}

post {
url: {{Bob_Data_Server}}/urn:uuid:b77c6d51-cd1f-4c9d-b5d4-091b22dd306b
body: json
auth: inherit
}

headers {
Content-Type: application/json
}

body:json {
{
"parentParts": [
{
"validityPeriod": {
"validFrom": "2023-03-21T08:47:14.438+01:00",
"validTo": "2024-08-02T09:00:00.000+01:00"
},
"parentCatenaXId": "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e",
"quantity": {
"quantityNumber": 2.5,
"measurementUnit": "unit:litre"
},
"createdOn": "2022-02-03T14:48:54.709Z",
"lastModifiedOn": "2022-02-03T14:48:54.709Z"
}
],
"catenaXId": "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: 02-Verify Data is Created
type: http
seq: 2
}

get {
url: {{Bob_Data_Server}}/urn:uuid:b77c6d51-cd1f-4c9d-b5d4-091b22dd306b
body: none
auth: inherit
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: 03-Create The Asset
type: http
seq: 3
}

post {
url: {{Bob}}/assets
body: json
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}

body:json {
{
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
"tx-auth": "https://w3id.org/tractusx/auth/",
"cx-policy": "https://w3id.org/catenax/policy/",
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@id": "{{ASSET_ID}}",
"properties": {
"description": "Product EDC Demo Asset"
},
"dataAddress": {
"@type": "DataAddress",
"type": "HttpData",
"proxyPath": "true",
"proxyMethod": "true",
"proxyQueryParams": "true",
"proxyBody": "true",
"baseUrl": "http://dataprovider-submodelserver.tx.test"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: 04-Validate The Asset
type: http
seq: 4
}

get {
url: {{Bob}}/assets/{{ASSET_ID}}
body: none
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
meta {
name: 05-Create The Policy
type: http
seq: 5
}

post {
url: {{Bob}}/policydefinitions
body: json
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}

body:json {
{
"@context": [
"https://w3id.org/catenax/2025/9/policy/odrl.jsonld",
"https://w3id.org/catenax/2025/9/policy/context.jsonld",
{
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
}
],
"@id": "{{ACCESS_POLICY_ID}}",
"@type": "PolicyDefinition",
"policy": {
"@type": "Set",
"permission": [
{
"action": "access",
"constraint": [
{
"and": [
{
"leftOperand": "Membership",
"operator": "eq",
"rightOperand": "active"
},
{
"leftOperand": "FrameworkAgreement",
"operator": "eq",
"rightOperand": "DataExchangeGovernance:1.0"
},
{
"leftOperand": "BusinessPartnerNumber",
"operator": "isAnyOf",
"rightOperand": ["{{Alice_BPN}}"]
}
]
}
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
meta {
name: 05_2-Create The Policy
type: http
seq: 6
}

post {
url: {{Bob}}/policydefinitions
body: json
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}

body:json {
{
"@context": [
"https://w3id.org/catenax/2025/9/policy/odrl.jsonld",
"https://w3id.org/catenax/2025/9/policy/context.jsonld",
{
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
{}
],
"@type": "PolicyDefinition",
"@id": "{{USAGE_POLICY_ID}}",
"policy": {
"@type": "Set",
"permission": [
{
"action": "use",
"constraint": {
"and": [
{
"leftOperand": "Membership",
"operator": "eq",
"rightOperand": "active"
},
{
"leftOperand": "FrameworkAgreement",
"operator": "eq",
"rightOperand": "DataExchangeGovernance:1.0"
},
{
"leftOperand": "UsagePurpose",
"operator": "isAnyOf",
"rightOperand": [
"cx.core.industrycore:1"
]
}
]
}
}
],
"prohibition": [],
"obligation": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: 06-Validate The Policy
type: http
seq: 7
}

get {
url: {{Bob}}/policydefinitions/{{ACCESS_POLICY_ID}}
body: none
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
meta {
name: 07-Create The Contract Definition
type: http
seq: 8
}

post {
url: {{Bob}}/contractdefinitions
body: json
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}

body:json {
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
},
"@id": "{{CONTRACT_ID}}",
"@type": "ContractDefinition",
"accessPolicyId": "{{ACCESS_POLICY_ID}}",
"contractPolicyId": "{{USAGE_POLICY_ID}}",
"assetsSelector": [
{
"@type": "CriterionDto",
"operandLeft": "https://w3id.org/edc/v0.0.1/ns/id",
"operator": "=",
"operandRight": "{{ASSET_ID}}"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: 08-Validate The Contract Definition
type: http
seq: 9
}

get {
url: {{Bob}}/contractdefinitions/{{CONTRACT_ID}}
body: none
auth: apikey
}

auth:apikey {
key: X-Api-Key
value: {{Bob_Api_Key}}
placement: header
}
4 changes: 4 additions & 0 deletions docs/usage/bruno/constructx-edc/01-Provide_Data/folder.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
meta {
name: 01-Provide_Data
seq: 2
}
Loading
Loading