Chilkat Online Tools

Swift / Salesforce Platform APIs / SObject Rows Delete

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

    // Adds the "Authorization: Bearer <access_token>" header.
    http.AuthToken = "<access_token>"
    http.SetRequestHeader("Content-Type", value: "application/json")

    var resp: CkoHttpResponse? = http.QuickRequest("DELETE", url: "https://domain.com/services/data/v{{version}}/sobjects/:SOBJECT_API_NAME/:RECORD_ID")
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    print("\(resp!.StatusCode.intValue)")
    print("\(resp!.BodyStr)")
    resp = nil

}

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
https://domain.com/services/data/v{{version}}/sobjects/:SOBJECT_API_NAME/:RECORD_ID

Postman Collection Item JSON

{
  "name": "SObject Rows Delete",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/sobjects/:SOBJECT_API_NAME/:RECORD_ID",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "sobjects",
        ":SOBJECT_API_NAME",
        ":RECORD_ID"
      ],
      "variable": [
        {
          "key": "SOBJECT_API_NAME",
          "value": ""
        },
        {
          "key": "RECORD_ID",
          "value": ""
        }
      ]
    },
    "description": "Accesses records based on the specified object ID. Retrieves, updates, or deletes records. This resource can also be used to retrieve field values. Use the GET method to retrieve records or fields, the DELETE method to delete records, and the PATCH method to update records."
  },
  "response": [
  ]
}