Chilkat Online Tools

C# / Creatio API / Delete a field of an object collection instance

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

http.SetRequestHeader("Content-Type","application/octet-stream; IEEE754Compatible=true");
http.SetRequestHeader("BPMCSRF","{{BPMCSRF}}");
http.SetRequestHeader("Accept","application/json; text/plain; */*");

Chilkat.HttpResponse resp = http.QuickRequest("DELETE","https://myserver.com/0/odata/Collection4(Id)/Field4");
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

int respStatusCode = resp.StatusCode;
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
if (respStatusCode != 204) {
    Debug.WriteLine("Response Header:");
    Debug.WriteLine(resp.Header);
    Debug.WriteLine("Response Body:");
    Debug.WriteLine(resp.BodyStr);
    Debug.WriteLine("Failed.");

    return;
}

Debug.WriteLine("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": ""
    }
  ]
}