Chilkat Online Tools

Objective-C / Creatio API / Delete object collection instance

Back to Collection Items

#import <CkoHttp.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;

[http SetRequestHeader: @"Content-Type" value: @"application/json; odata=verbose"];
[http SetRequestHeader: @"ForceUseSession" value: @"true"];
[http SetRequestHeader: @"BPMCSRF" value: @"{{BPMCSRF}}"];
[http SetRequestHeader: @"Accept" value: @"application/json; odata=verbose"];

CkoHttpResponse *resp = [http QuickRequest: @"DELETE" url: @"https://myserver.com/0/ServiceModel/EntityDataService.svc/Collection3Collection(guid'Id')"];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

int respStatusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
if (respStatusCode != 204) {
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",resp.Header);
    NSLog(@"%@",@"Response Body:");
    NSLog(@"%@",resp.BodyStr);
    NSLog(@"%@",@"Failed.");

    return;
}

NSLog(@"%@",@"Success.");

Curl Command

curl -X DELETE
	-H "Accept: application/json; odata=verbose"
	-H "Content-Type: application/json; odata=verbose"
	-H "ForceUseSession: true"
	-H "BPMCSRF: {{BPMCSRF}}"
https://myserver.com/0/ServiceModel/EntityDataService.svc/Collection3Collection(guid'Id')

Postman Collection Item JSON

{
  "name": "Delete object collection instance",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json; odata=verbose",
        "type": "text"
      },
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "value": "application/json; odata=verbose",
        "type": "text"
      },
      {
        "key": "ForceUseSession",
        "value": "true",
        "type": "text"
      },
      {
        "key": "BPMCSRF",
        "value": "{{BPMCSRF}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{BaseURI}}/0/ServiceModel/EntityDataService.svc/{{CollectionName3}}Collection(guid'{{ObjectId1}}')",
      "host": [
        "{{BaseURI}}"
      ],
      "path": [
        "0",
        "ServiceModel",
        "EntityDataService.svc",
        "{{CollectionName3}}Collection(guid'{{ObjectId1}}')"
      ]
    },
    "description": "Request for deleting an object collection instance."
  },
  "response": [
    {
      "name": "[204] Deletes an object collection instance",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "key": "Accept",
            "value": "application/json; odata=verbose",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json; odata=verbose",
            "type": "text"
          },
          {
            "key": "ForceUseSession",
            "value": "true",
            "type": "text"
          },
          {
            "key": "BPMCSRF",
            "value": "{{BPMCSRF}}",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://myserver.com/0/ServiceModel/EntityDataService.svc/ContactCollection(guid'c31c7862-fe33-4a13-9bbc-0943fa08fd02')",
          "protocol": "https",
          "host": [
            "myserver",
            "com"
          ],
          "path": [
            "0",
            "ServiceModel",
            "EntityDataService.svc",
            "ContactCollection(guid'c31c7862-fe33-4a13-9bbc-0943fa08fd02')"
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "xml",
      "header": [
        {
          "key": "Cache-Control",
          "value": "private"
        },
        {
          "key": "Content-Type",
          "value": "text/html; charset=utf-8"
        },
        {
          "key": "Server",
          "value": "Microsoft-IIS/10.0"
        },
        {
          "key": "X-Powered-By",
          "value": "ASP.NET"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "Date",
          "value": "Thu, 09 Apr 2020 11:33:25 GMT"
        },
        {
          "key": "Content-Length",
          "value": "5012"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}