Skip to content

Commit

Permalink
fix: postman headers (#348)
Browse files Browse the repository at this point in the history
* fix: Move `X-Api-Key` to collection level, add `Content-Type` to each request.

The headers `X-Api-Key:password` and `Content-Type` should be default for every request and therefore don't have to be added to each request individually.

* fix: Fix indentation

* fix: add `X-Api-Key`

* fix: remove `Content-Type`from GET requests

* fix: add prerequisite script to add Content-Type: application/json to POST and PUT requests

* fix: remove duplicated Content-Type: application/json from individual requests

* fix: fix syntax and indentation

* fix: move prerequisite script to collection level
  • Loading branch information
nikschul authored Sep 27, 2024
1 parent 94cecc6 commit f87b660
Showing 1 changed file with 28 additions and 170 deletions.
198 changes: 28 additions & 170 deletions deployment/postman/MVD.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@
"name": "Create Asset 1",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"asset-1\",\n \"@type\": \"Asset\",\n \"properties\": {\n \"description\": \"This asset requires Membership to view and negotiate.\"\n },\n \"dataAddress\": {\n \"@type\": \"DataAddress\",\n \"type\": \"HttpData\",\n \"baseUrl\": \"https://jsonplaceholder.typicode.com/todos\",\n \"proxyPath\": \"true\",\n \"proxyQueryParams\": \"true\"\n }\n}"
Expand All @@ -46,16 +37,7 @@
"name": "Create Asset 2",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"asset-2\",\n \"@type\": \"Asset\",\n \"properties\": {\n \"description\": \"This asset requires Membership to view and SensitiveData credential to negotiate.\"\n },\n \"dataAddress\": {\n \"@type\": \"DataAddress\",\n \"type\": \"HttpData\",\n \"baseUrl\": \"https://jsonplaceholder.typicode.com/todos\",\n \"proxyPath\": \"true\",\n \"proxyQueryParams\": \"true\"\n }\n}"
Expand All @@ -79,16 +61,7 @@
"name": "Create Membership Policy",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"PolicyDefinition\",\n \"@id\": \"require-membership\",\n \"policy\": {\n \"@type\": \"Set\",\n \"permission\": [\n {\n \"action\": \"use\",\n \"constraint\": {\n \"leftOperand\": \"MembershipCredential\",\n \"operator\": \"eq\",\n \"rightOperand\": \"active\"\n }\n }\n ]\n }\n}"
Expand All @@ -112,16 +85,7 @@
"name": "Create DataProcessor policy",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"PolicyDefinition\",\n \"@id\": \"require-dataprocessor\",\n \"policy\": {\n \"@type\": \"Set\",\n \"obligation\": [\n {\n \"action\": \"use\",\n \"constraint\": {\n \"leftOperand\": \"DataAccess.level\",\n \"operator\": \"eq\",\n \"rightOperand\": \"processing\"\n }\n }\n ]\n }\n}"
Expand All @@ -145,16 +109,7 @@
"name": "Create Sensitive Data Processor policy",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"PolicyDefinition\",\n \"@id\": \"require-sensitive\",\n \"policy\": {\n \"@type\": \"Set\",\n \"obligation\": [\n {\n \"action\": \"use\",\n \"constraint\": {\n \"leftOperand\": \"DataAccess.level\",\n \"operator\": \"eq\",\n \"rightOperand\": \"sensitive\"\n }\n }\n ]\n }\n}"
Expand All @@ -178,16 +133,7 @@
"name": "Create \"member-and-data-cred\" definition",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"member-and-dataprocessor-def\",\n \"@type\": \"ContractDefinition\",\n \"accessPolicyId\": \"require-membership\",\n \"contractPolicyId\": \"require-dataprocessor\",\n \"assetsSelector\": {\n \"@type\": \"Criterion\",\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\n \"operator\": \"=\",\n \"operandRight\": \"asset-1\"\n }\n}"
Expand All @@ -211,16 +157,7 @@
"name": "Create \"require sensitive\" definition",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"sensitive-only-def\",\n \"@type\": \"ContractDefinition\",\n \"accessPolicyId\": \"require-membership\",\n \"contractPolicyId\": \"require-sensitive\",\n \"assetsSelector\": {\n \"@type\": \"Criterion\",\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\n \"operator\": \"=\",\n \"operandRight\": \"asset-2\"\n }\n}"
Expand Down Expand Up @@ -271,16 +208,7 @@
"name": "Create linked Asset for provider-qna",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"linked-asset-provider-qna\",\n \"@type\": \"CatalogAsset\",\n \"properties\": {\n \"description\": \"This is a linked asset that points to the catalog of the provider's Q&A department.\",\n \"isCatalog\": \"true\"\n },\n \"dataAddress\": {\n \"@type\": \"DataAddress\",\n \"type\": \"HttpData\",\n \"baseUrl\": \"{{PROVIDER_QNA_DSP_URL}}/api/dsp\"\n }\n}",
Expand Down Expand Up @@ -338,16 +266,7 @@
"name": "Create normal asset for CatalogServer",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"normal-asset-1\",\n \"@type\": \"Asset\",\n \"properties\": {\n \"description\": \"This is a conventional asset, not a CatalogAsset.\"\n },\n \"dataAddress\": {\n \"@type\": \"DataAddress\",\n \"type\": \"HttpData\",\n \"baseUrl\": \"https://jsonplaceholder.typicode.com/todos\",\n \"proxyPath\": \"true\",\n \"proxyQueryParams\": \"true\"\n }\n}"
Expand All @@ -371,16 +290,7 @@
"name": "Create Membership Policy",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"PolicyDefinition\",\n \"@id\": \"require-membership\",\n \"policy\": {\n \"@type\": \"Set\",\n \"permission\": [\n {\n \"action\": \"use\",\n \"constraint\": {\n \"leftOperand\": \"MembershipCredential\",\n \"operator\": \"eq\",\n \"rightOperand\": \"active\"\n }\n }\n ]\n }\n}"
Expand All @@ -404,16 +314,7 @@
"name": "Create \"require membership\" definition",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@id\": \"membership-required-def\",\n \"@type\": \"ContractDefinition\",\n \"accessPolicyId\": \"require-membership\",\n \"contractPolicyId\": \"require-membership\",\n \"assetsSelector\": {\n \"@type\": \"Criterion\",\n \"operandLeft\": \"https://w3id.org/edc/v0.0.1/ns/id\",\n \"operator\": \"in\",\n \"operandRight\": [\n \"linked-asset-provider-qna\",\n \"linked-asset-provider-manufacturing\",\n \"normal-asset-1\"\n ]\n }\n}"
Expand Down Expand Up @@ -464,16 +365,7 @@
"name": "Get Assets",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": {\n \"@vocab\": \"https://w3id.org/edc/v0.0.1/ns/\"\n },\n \"@type\": \"QuerySpec\"\n}"
Expand All @@ -498,16 +390,7 @@
"name": "Request Catalog",
"request": {
"method": "POST",
"header": [
{
"key": "X-Api-Key",
"value": "password"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"CatalogRequest\",\n \"counterPartyAddress\": \"{{CATALOG_SERVER_DSP_URL}}/api/dsp\",\n \"counterPartyId\": \"{{PROVIDER_ID}}\",\n \"protocol\": \"dataspace-protocol-http\",\n \"querySpec\": {\n \"offset\": 0,\n \"limit\": 50\n }\n}"
Expand Down Expand Up @@ -562,12 +445,7 @@
"name": "Initiate negotiation",
"request": {
"method": "POST",
"header": [
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"ContractRequest\",\n \"counterPartyAddress\": \"{{PROVIDER_DSP_URL}}/api/dsp\",\n \"counterPartyId\": \"{{PROVIDER_ID}}\",\n \"protocol\": \"dataspace-protocol-http\",\n \"policy\": {\n \"@type\": \"Offer\",\n \"@id\": \"bWVtYmVyLWFuZC1kYXRhcHJvY2Vzc29yLWRlZg==:YXNzZXQtMQ==:MmQ0ZWZjZTYtYzJjNy00NTM5LTk5ODAtZDAwOTlkZDNkOWQy\",\n \"assigner\": \"{{PROVIDER_ID}}\",\n \"permission\": [],\n \"prohibition\": [],\n \"obligation\": {\n \"action\": \"use\",\n \"constraint\": {\n \"leftOperand\": \"DataAccess.level\",\n \"operator\": \"eq\",\n \"rightOperand\": \"processing\"\n }\n },\n \"target\": \"asset-1\"\n },\n \"callbackAddresses\": []\n}",
Expand Down Expand Up @@ -596,16 +474,7 @@
"name": "Get Contract Negotiations",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Api-Key",
"value": "password"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"QuerySpec\"\n}"
Expand Down Expand Up @@ -689,16 +558,7 @@
"name": "Get cached EDRs",
"request": {
"method": "POST",
"header": [
{
"key": "X-Api-Key",
"value": "password"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"@context\": [\n \"https://w3id.org/edc/connector/management/v0.0.1\"\n ],\n \"@type\": \"QuerySpec\"\n}"
Expand All @@ -723,16 +583,7 @@
"name": "Get EDR DataAddress for TransferId",
"request": {
"method": "GET",
"header": [
{
"key": "X-Api-Key",
"value": "password"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"header": [],
"url": {
"raw": "{{HOST}}/api/management/v3/edrs/713dfab7-c70a-4c7b-9756-d372647276b5/dataaddress",
"host": [
Expand All @@ -758,10 +609,6 @@
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTcwOTMja2V5LTEiLCJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTcwOTMiLCJhdWQiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTcwODMiLCJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTcwOTMiLCJpYXQiOjE3MjEzOTMxNjU5ODgsImp0aSI6ImFmOWI2YWIyLTMwNjYtNDNlNi1hNjg1LWIyMDVjNTFkZmJhMyJ9.ute0sLuMgc0bzG_ZUGG9G3pliFfANf9pWDxReiRrWjGudgUa4YmR9ftB5LeZTOvKCBJshRpbZX-hnQxR8fXMWA",
Expand Down Expand Up @@ -2066,6 +1913,17 @@
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"if(pm.request.method == \"POST\" || pm.request.method == \"PUT\"){",
" pm.request.headers.add(\"Content-Type: application/json\");",
"}"
]
}
},
{
"listen": "prerequest",
"script": {
Expand Down

0 comments on commit f87b660

Please sign in to comment.