Chilkat Online Tools

Ruby / Salesforce Platform APIs / Delete a Record

Back to Collection Items

require 'chilkat'

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

http = Chilkat::CkHttp.new()

# Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>")

# resp is a CkHttpResponse
resp = http.QuickRequest("DELETE","https://domain.com/services/data/v{{version}}/ui-api/records/:RECORD_ID")
if (http.get_LastMethodSuccess() == false)
    print http.lastErrorText() + "\n";
    exit
end

print resp.get_StatusCode().to_s() + "\n";
print resp.bodyStr() + "\n";

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/ui-api/records/:RECORD_ID

Postman Collection Item JSON

{
  "name": "Delete a Record",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": ""
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/records/:RECORD_ID",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "ui-api",
        "records",
        ":RECORD_ID"
      ],
      "variable": [
        {
          "key": "RECORD_ID",
          "value": "",
          "description": "Record ID"
        }
      ]
    },
    "description": "Update a record's data.\nUser Interface API enforces Salesforce validation rules. If a validation rule fails, the response is an Error with Output.\n\nWhen you make a PATCH request to update a record, make sure that the record hasn’t changed since the user started editing it. To find out whether it’s safe to save a record, pass the If-Modified-Since HTTP header in the request.\n\nAs of API version 43.0, if you pass read-only fields in a request body, the response is an Error with Output."
  },
  "response": [
    {
      "name": "Delete a Record",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": ""
        },
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/records/:RECORD_ID",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "ui-api",
            "records",
            ":RECORD_ID"
          ],
          "variable": [
            {
              "key": "RECORD_ID",
              "value": "0011Q00002Z2P5jQAF",
              "description": "Record ID"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "plain",
      "header": [
        {
          "key": "Date",
          "value": "Wed, 27 Sep 2023 16:05:14 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Content-Security-Policy",
          "value": "upgrade-insecure-requests"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        }
      ],
      "cookie": [
      ],
      "body": null
    }
  ]
}