PowerBuilder / Anypoint Platform APIs / Delete dependency to asset Copy
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Jarr
oleobject loo_JsonObj_1
oleobject loo_SbRequestBody
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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"
// }
// ]
loo_Jarr = create oleobject
// Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0
li_rc = loo_Jarr.ConnectToNewObject("Chilkat.JsonArray")
loo_Jarr.AddObjectAt(-1)
loo_JsonObj_1 = loo_Jarr.ObjectAt(loo_Jarr.Size - 1)
loo_JsonObj_1.UpdateString("groupId","bc6c7bb9-87c7-4220-833b-40509c780dd4")
loo_JsonObj_1.UpdateString("assetId","banking-user")
loo_JsonObj_1.UpdateString("version","1.0.1")
destroy loo_JsonObj_1
loo_Http.SetRequestHeader("X-OWNER-ID","{{owner_id}}")
loo_Http.SetRequestHeader("X-ANYPNT-ENV-ID","{{environment-id}}")
// Adds the "Authorization: Bearer 96b384f7-a6d2-43f9-a14b-652f60048b17" header.
loo_Http.AuthToken = "96b384f7-a6d2-43f9-a14b-652f60048b17"
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_Http.SetRequestHeader("X-ANYPNT-ORG-ID","{{org-id}}")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Jarr.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("DELETE","https://domain.com/designcenter/api-designer/projects/{{project_id}}/branches/{{branch_name}}/exchange/dependencies",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Jarr
destroy loo_SbRequestBody
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Jarr
destroy loo_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": [
]
}