2

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?

Thanks.

2

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.

| improve this answer | |
1

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

| improve this answer | |
  • Did you actually try this? ALL ROWS is only to be used for APEX, so your solution is wrong. – Alexandru Luchian Nov 29 '12 at 15:15
  • I told its Apex rest.Please and i clearly mentioned standard REST service wont help.We need Apex code . – Mohith Shrivastava Nov 29 '12 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. – Alexandru Luchian Nov 29 '12 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 . – Mohith Shrivastava Nov 29 '12 at 16:46
0

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

/services/data/v29.0/sobjects/Merchandise__c/deleted/​​​?start=2013-05-05T00%3A00%3A00%2B00%3A00&end=2013-05-10T00%3A00%3A00%2B00%3A00
| improve this answer | |

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.