Objective-C / Anypoint Platform APIs / Delete dependency to asset Copy
Back to Collection Items
#import <CkoHttp.h>
#import <CkoJsonArray.h>
#import <CkoJsonObject.h>
#import <CkoStringBuilder.h>
#import <CkoHttpResponse.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;
// 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"
// }
// ]
CkoJsonArray *jarr = [[CkoJsonArray alloc] init];
[jarr AddObjectAt: [NSNumber numberWithInt: -1]];
CkoJsonObject *jsonObj_1 = [jarr ObjectAt: [NSNumber numberWithInt: ([jarr.Size intValue] - 1)]];
[jsonObj_1 UpdateString: @"groupId" value: @"bc6c7bb9-87c7-4220-833b-40509c780dd4"];
[jsonObj_1 UpdateString: @"assetId" value: @"banking-user"];
[jsonObj_1 UpdateString: @"version" value: @"1.0.1"];
[http SetRequestHeader: @"X-OWNER-ID" value: @"{{owner_id}}"];
[http SetRequestHeader: @"X-ANYPNT-ENV-ID" value: @"{{environment-id}}"];
// Adds the "Authorization: Bearer 96b384f7-a6d2-43f9-a14b-652f60048b17" header.
http.AuthToken = @"96b384f7-a6d2-43f9-a14b-652f60048b17";
[http SetRequestHeader: @"Content-Type" value: @"application/json"];
[http SetRequestHeader: @"X-ANYPNT-ORG-ID" value: @"{{org-id}}"];
CkoStringBuilder *sbRequestBody = [[CkoStringBuilder alloc] init];
[jarr EmitSb: sbRequestBody];
CkoHttpResponse *resp = [http PTextSb: @"DELETE" url: @"https://domain.com/designcenter/api-designer/projects/{{project_id}}/branches/{{branch_name}}/exchange/dependencies" textData: sbRequestBody charset: @"utf-8" contentType: @"application/json" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);
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": [
]
}