Chilkat Online Tools

Swift3 / Creatio API / Delete a field of an object collection instance

Back to Collection Items

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

    let http = CkoHttp()!
    var success: Bool

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

    var resp: CkoHttpResponse? = http.quickRequest("DELETE", url: "https://myserver.com/0/odata/Collection4(Id)/Field4")
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    var respStatusCode: Int = resp!.statusCode.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode != 204 {
        print("Response Header:")
        print("\(resp!.header!)")
        print("Response Body:")
        print("\(resp!.bodyStr!)")
        print("Failed.")
        resp = nil
        return
    }

    resp = nil
    print("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": ""
    }
  ]
}