Skip to content

Commit 97d41a0

Browse files
update readme, Bruno collection
1 parent ffcf359 commit 97d41a0

85 files changed

Lines changed: 6057 additions & 998 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 224 additions & 576 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
meta {
2+
name: Download Data from Public API
3+
type: http
4+
seq: 9
5+
}
6+
7+
get {
8+
url: {{PROVIDER_PUBLIC_URL}}/api/public
9+
body: none
10+
auth: none
11+
}
12+
13+
headers {
14+
Authorization: {{AUTHORIZATION}}
15+
}
16+
17+
script:pre-request {
18+
if(!(bru.getVar("AUTHORIZATION") !== undefined && bru.getVar("AUTHORIZATION") !== null)){
19+
throw new Error(' The authorization token is not yet available, please execute request "Get EDR DataAddress for TransferId" first!');
20+
}
21+
}
22+
23+
script:post-response {
24+
test("Status code is >=200 and <300", function () {
25+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
26+
});
27+
}
28+
29+
settings {
30+
encodeUrl: true
31+
timeout: 0
32+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
meta {
2+
name: Get Assets
3+
type: http
4+
seq: 1
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/assets/request
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@type": "QuerySpec"
16+
}
17+
}
18+
19+
body:text {
20+
{
21+
"@context": {
22+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
23+
},
24+
"@type": "QuerySpec"
25+
}
26+
}
27+
28+
script:post-response {
29+
test("Status code is >=200 and <300", function () {
30+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
31+
});
32+
}
33+
34+
settings {
35+
encodeUrl: true
36+
timeout: 0
37+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
meta {
2+
name: Get Contract Negotiations
3+
type: http
4+
seq: 4
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/contractnegotiations/request
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"@type": "QuerySpec"
19+
}
20+
}
21+
22+
body:text {
23+
{
24+
"@context": [
25+
"https://w3id.org/edc/connector/management/v2"
26+
],
27+
"@type": "QuerySpec"
28+
}
29+
}
30+
31+
script:post-response {
32+
// get the contact agreement id and save it as an environment variable
33+
if(res.getStatus() < 300 && res.getStatus() >= 200 && res.getBody().length > 0){
34+
var find_negotiation;
35+
if (bru.getVar("CONTRACT_NEGOTIATION_ID") !== undefined && bru.getVar("CONTRACT_NEGOTIATION_ID") !== null){
36+
find_negotiation = res.getBody().find((el) => el["@id"] == bru.getVar("CONTRACT_NEGOTIATION_ID"))
37+
}
38+
39+
if(find_negotiation){
40+
const contractAgreementId = find_negotiation["contractAgreementId"];
41+
bru.setVar("CONTRACT_AGREEMENT_ID", contractAgreementId);
42+
}
43+
}
44+
45+
test("Status code is >=200 and <300", function () {
46+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
47+
});
48+
test("Contract Agreement ID is set", function(){
49+
expect(bru.getVar("CONTRACT_AGREEMENT_ID")).not.to.be.undefined
50+
})
51+
52+
}
53+
54+
settings {
55+
encodeUrl: true
56+
timeout: 0
57+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
meta {
2+
name: Get EDR DataAddress for TransferId
3+
type: http
4+
seq: 8
5+
}
6+
7+
get {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/edrs/{{TRANSFER_PROCESS_ID}}/dataaddress
9+
body: none
10+
auth: inherit
11+
}
12+
13+
script:pre-request {
14+
if(!(bru.getVar("TRANSFER_PROCESS_ID") !== undefined && bru.getVar("TRANSFER_PROCESS_ID") !== null)){
15+
throw new Error('Transfer Process ID is not yet available, please execute request "Get Transfer Processes" first!');
16+
}
17+
}
18+
19+
script:post-response {
20+
// get the authorization token and save it as an environment variable
21+
if(res.getStatus() < 300 && res.getStatus() >= 200){
22+
//using the first authorization token found
23+
const authorization = res.getBody()["authorization"];
24+
bru.setVar("AUTHORIZATION", authorization);
25+
}
26+
27+
28+
}
29+
30+
settings {
31+
encodeUrl: true
32+
timeout: 0
33+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
meta {
2+
name: Get cached EDRs
3+
type: http
4+
seq: 7
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/edrs/request
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"@type": "QuerySpec"
19+
}
20+
}
21+
22+
body:text {
23+
{
24+
"@context": [
25+
"https://w3id.org/edc/connector/management/v2"
26+
],
27+
"@type": "QuerySpec"
28+
}
29+
}
30+
31+
script:post-response {
32+
// get the transfer process id of "asset-1" and save it as an environment variable if the response body is not empty
33+
if(res.getStatus() < 300 && res.getStatus() >= 200 && res.getBody().length > 0){
34+
const transferProcessId = res.getBody()[0]["transferProcessId"];
35+
bru.setVar("TRANSFER_PROCESS_ID", transferProcessId);
36+
}
37+
38+
test("Status code is >=200 and <300", function () {
39+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
40+
});
41+
test("Transfer process id is set", function(){
42+
expect(bru.getVar("TRANSFER_PROCESS_ID")).not.to.be.undefined
43+
})
44+
45+
}
46+
47+
settings {
48+
encodeUrl: true
49+
timeout: 0
50+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
meta {
2+
name: Get transfer processes
3+
type: http
4+
seq: 6
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/transferprocesses/request
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"@type": "QuerySpec"
19+
}
20+
}
21+
22+
script:post-response {
23+
test("Status code is >=200 and <300", function () {
24+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
25+
});
26+
27+
}
28+
29+
settings {
30+
encodeUrl: true
31+
timeout: 0
32+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
meta {
2+
name: Initiate Transfer
3+
type: http
4+
seq: 5
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/transferprocesses
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"assetId": "asset-1",
19+
"@type": "TransferRequest",
20+
"counterPartyAddress": "{{PROVIDER_DSP}}",
21+
"connectorId": "{{PROVIDER_ID}}",
22+
"contractId": "{{CONTRACT_AGREEMENT_ID}}",
23+
"dataDestination": {
24+
"type": "HttpProxy"
25+
},
26+
"protocol": "dataspace-protocol-http",
27+
"transferType": "HttpData-PULL"
28+
}
29+
}
30+
31+
script:pre-request {
32+
if(!(bru.getVar("CONTRACT_AGREEMENT_ID") !== undefined && bru.getVar("CONTRACT_AGREEMENT_ID") !== null)){
33+
throw new Error('Contract Agreement ID is not yet available, please execute requests "Initiate Negotiation and Get Contract Negotiation" first!');
34+
}
35+
}
36+
37+
script:post-response {
38+
test("Status code is >=200 and <300", function () {
39+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
40+
});
41+
42+
}
43+
44+
settings {
45+
encodeUrl: true
46+
timeout: 0
47+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
meta {
2+
name: Initiate negotiation
3+
type: http
4+
seq: 3
5+
}
6+
7+
post {
8+
url: {{CONSUMER_CP}}/api/mgmt/v4beta/contractnegotiations
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"@type": "ContractRequest",
19+
"counterPartyAddress": "{{PROVIDER_DSP}}",
20+
"counterPartyId": "{{PROVIDER_ID}}",
21+
"protocol": "dataspace-protocol-http:2025-1",
22+
"policy": {
23+
"@type": "Offer",
24+
"@id": "{{POLICY_ID_ASSET_1}}",
25+
"assigner": "{{PROVIDER_ID}}",
26+
"permission": [],
27+
"prohibition": [],
28+
"obligation": {
29+
"action": "use",
30+
"constraint": {
31+
"leftOperand": "ManufacturerCredential.part_types",
32+
"operator": "eq",
33+
"rightOperand": "non_critical"
34+
}
35+
},
36+
"target": "asset-1"
37+
},
38+
"callbackAddresses": []
39+
}
40+
}
41+
42+
script:pre-request {
43+
if(!(bru.getVar("POLICY_ID_ASSET_1") !== undefined && bru.getVar("POLICY_ID_ASSET_1") !== null)){
44+
throw new Error('Policy-ID of Asset-1 is not yet available, please execute request "Get Cached Catalog" first!');
45+
}
46+
}
47+
48+
script:post-response {
49+
bru.setVar("CONTRACT_NEGOTIATION_ID", res.getBody()["@id"])
50+
51+
test("Status code is >=200 and <300", function () {
52+
expect(res.getStatus() < 300 && res.getStatus() >= 200).to.be.true
53+
});
54+
test("Contract negotiation id is set", function(){
55+
expect(bru.getVar("CONTRACT_NEGOTIATION_ID")).not.to.be.undefined
56+
})
57+
}
58+
59+
settings {
60+
encodeUrl: true
61+
timeout: 0
62+
}

0 commit comments

Comments
 (0)