function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alek Mesarovich 9Alek Mesarovich 9 

REST API: getting deleted records

I'm trying to get a list of deleted records through the REST API but it doesn't seem to be working.

Here is the CURL command I'm using (pretty much straight from the doc).

curl -v 'https://na30.salesforce.com/services/data/v20.0/sobjects/lead/deleted/' \
-H 'Authorization: Bearer <lots of characters>' \
-H 'X-PrettyPrint:1' \
-d 'start=2016-06-19T21:32:42.000+0000' \
-d 'end=2016-08-19T21:32:42.000+0000'

Here's the response I get:

[ {
  "errorCode" : "NOT_FOUND",
  "message" : "The requested resource does not exist"
} ]* Connection #0 to host na30.salesforce.com left intact

What should this command look like?
 
Felix NilamFelix Nilam
The REST API to get the list of deleted objects must be specified as GET (as the HTTP method).
In this case, you need to call your curl with -X GET.  By default if you just call curl without the -X argument, it will be a POST.
Additionally, since this is a GET request, you need to append the start and end as a URI to the URLs.
The start and end string also needs to be in the right format and url encoded.

So the curl command should be something like the following:
curl -H 'Authorization: Bearer <access token>' -X GET 'https://na30.salesforce.com/services/data/v20.0/sobjects/Lead/deleted?start=2016-06-19T21%3A32%3A42%2B00%3A00&end=2016-08-19T21%3A32%3A42%2B00%3A00'

Hope this helps,
Felix
Alek Mesarovich 9Alek Mesarovich 9
I just tried exactly the command you had, did a cut&paste, putting in a fresh new access token. Still got: [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}] Alek