I am using Salesforce Android SDK version 1.3.1.

I am trying to query all Contacts (deleted as well).

But no matter what I do, I don't seem to be able to retrieve the deleted records, meaning those that have IsDeleted=true.

My code:

RestRequest request = RestRequest.getRequestForQuery("v25.0", "SELECT Id, IsDeleted FROM Contact");

But I always get only non-deleted Contacts.

I read on a forum somewhere that you can't query deleted records via the Rest API.

Any ideas?



3 Answers 3


You can use the SOAP API's getDeleted call. The docs contain sample Java code. You can use the same OAuth token you use with the REST API as the session id for the SOAP call.

As of API version 29.0, you can use the queryAll REST endpoint with IsDeleted=true in your query.


You can construct a Apex Rest Service and for Query use 'ALL ROWS' and this fetches all the data even from the recycle bin and you can identify with isdeleted.I dont believe we have standard Rest API for the same

  • Did you actually try this? ALL ROWS is only to be used for APEX, so your solution is wrong. Nov 29, 2012 at 15:15
  • I told its Apex rest.Please and i clearly mentioned standard REST service wont help.We need Apex code . Nov 29, 2012 at 15:23
  • Mohith, I can't create an Apex Rest Service, I am not allowed to create any Apex code on customer's organizations. All I have is the Rest API from the Android device. Nov 29, 2012 at 15:37
  • @AlexandruLuchian Unfortunately i am sorry to say there is no other way to retrieve Data from recycle bin in salesforce through the REST API that we have . Nov 29, 2012 at 16:46

You can query the deleted records from Salesforce using the REST API. For that you will need to pass the Start and End datetime. https://www.salesforce.com/us/developer/docs/api_rest/Content/dome_get_deleted.htm


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.