unicodeC / Anypoint Platform APIs / Delete dependency to asset Copy
Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonArrayW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonArrayW jarr;
HCkJsonObjectW jsonObj_1;
HCkStringBuilderW sbRequestBody;
HCkHttpResponseW resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// [
// {
// "groupId": "bc6c7bb9-87c7-4220-833b-40509c780dd4",
// "assetId": "banking-user",
// "version": "1.0.1"
// }
// ]
jarr = CkJsonArrayW_Create();
CkJsonArrayW_AddObjectAt(jarr,-1);
jsonObj_1 = CkJsonArrayW_ObjectAt(jarr,CkJsonArrayW_getSize(jarr) - 1);
CkJsonObjectW_UpdateString(jsonObj_1,L"groupId",L"bc6c7bb9-87c7-4220-833b-40509c780dd4");
CkJsonObjectW_UpdateString(jsonObj_1,L"assetId",L"banking-user");
CkJsonObjectW_UpdateString(jsonObj_1,L"version",L"1.0.1");
CkJsonObjectW_Dispose(jsonObj_1);
CkHttpW_SetRequestHeader(http,L"X-OWNER-ID",L"{{owner_id}}");
CkHttpW_SetRequestHeader(http,L"X-ANYPNT-ENV-ID",L"{{environment-id}}");
// Adds the "Authorization: Bearer 96b384f7-a6d2-43f9-a14b-652f60048b17" header.
CkHttpW_putAuthToken(http,L"96b384f7-a6d2-43f9-a14b-652f60048b17");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
CkHttpW_SetRequestHeader(http,L"X-ANYPNT-ORG-ID",L"{{org-id}}");
sbRequestBody = CkStringBuilderW_Create();
CkJsonArrayW_EmitSb(jarr,sbRequestBody);
resp = CkHttpW_PTextSb(http,L"DELETE",L"https://domain.com/designcenter/api-designer/projects/{{project_id}}/branches/{{branch_name}}/exchange/dependencies",sbRequestBody,L"utf-8",L"application/json",FALSE,FALSE);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonArrayW_Dispose(jarr);
CkStringBuilderW_Dispose(sbRequestBody);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonArrayW_Dispose(jarr);
CkStringBuilderW_Dispose(sbRequestBody);
}
Curl Command
curl -X DELETE
-H "Authorization: Bearer 96b384f7-a6d2-43f9-a14b-652f60048b17"
-H "X-ANYPNT-ENV-ID: {{environment-id}}"
-H "X-ANYPNT-ORG-ID: {{org-id}}"
-H "Content-Type: application/json"
-H "X-OWNER-ID: {{owner_id}}"
-d '[
{
"groupId": "bc6c7bb9-87c7-4220-833b-40509c780dd4",
"assetId": "banking-user",
"version": "1.0.1"
}
]'
https://domain.com/designcenter/api-designer/projects/{{project_id}}/branches/{{branch_name}}/exchange/dependencies
Postman Collection Item JSON
{
"name": "Delete dependency to asset Copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = pm.response.json();",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Authorization",
"value": "Bearer 96b384f7-a6d2-43f9-a14b-652f60048b17"
},
{
"key": "X-ANYPNT-ENV-ID",
"type": "text",
"value": "{{environment-id}}"
},
{
"key": "X-ANYPNT-ORG-ID",
"type": "text",
"value": "{{org-id}}"
},
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "X-OWNER-ID",
"value": "{{owner_id}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "[\n {\n \"groupId\": \"bc6c7bb9-87c7-4220-833b-40509c780dd4\",\n \"assetId\": \"banking-user\",\n \"version\": \"1.0.1\"\n }\n]",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/designcenter/api-designer/projects/{{project_id}}/branches/{{branch_name}}/exchange/dependencies",
"host": [
"{{url}}"
],
"path": [
"designcenter",
"api-designer",
"projects",
"{{project_id}}",
"branches",
"{{branch_name}}",
"exchange",
"dependencies"
]
}
},
"response": [
]
}