Chilkat Online Tools

Objective-C / Creatio API / Delete a field of an 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/octet-stream; IEEE754Compatible=true"];
[http SetRequestHeader: @"BPMCSRF" value: @"{{BPMCSRF}}"];
[http SetRequestHeader: @"Accept" value: @"application/json; text/plain; */*"];

CkoHttpResponse *resp = [http QuickRequest: @"DELETE" url: @"https://myserver.com/0/odata/Collection4(Id)/Field4"];
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; text/plain; */*"
	-H "Content-Type: application/octet-stream; IEEE754Compatible=true"
	-H "BPMCSRF: {{BPMCSRF}}"
https://myserver.com/0/odata/Collection4(Id)/Field4

Postman Collection Item JSON

{
  "name": "Delete a field of an object collection instance",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json; text/plain; */*",
        "type": "text"
      },
      {
        "key": "Content-Type",
        "value": "application/octet-stream; IEEE754Compatible=true",
        "type": "text"
      },
      {
        "key": "BPMCSRF",
        "value": "{{BPMCSRF}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{BaseURI}}/0/odata/{{CollectionName4}}({{ObjectId2}})/{{FieldName4}}",
      "host": [
        "{{BaseURI}}"
      ],
      "path": [
        "0",
        "odata",
        "{{CollectionName4}}({{ObjectId2}})",
        "{{FieldName4}}"
      ]
    },
    "description": "Request for deleting a field of an object collection instance."
  },
  "response": [
    {
      "name": "[204] Deletes an object collection instance",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "key": "Accept",
            "value": "application/json; text/plain; */*",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/octet-stream; IEEE754Compatible=true",
            "type": "text"
          },
          {
            "key": "BPMCSRF",
            "value": "{{BPMCSRF}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://myserver.com/0/odata/SysImage(29FE7EDF-4DB9-4E09-92B0-018047BA1F71)/Data",
          "protocol": "https",
          "host": [
            "myserver",
            "com"
          ],
          "path": [
            "0",
            "odata",
            "SysImage(29FE7EDF-4DB9-4E09-92B0-018047BA1F71)",
            "Data"
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "Text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}