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
Sailor67Sailor67 

Pls. help with query for IsDeleted field REST API

I am using the standard http based REST API via Xml (i.e. not APEX or SOAP) and so the QueryAll() method is not available.

 

I have tried various queries but can't get this to work..

What am I doing wrong here..?

 

SELECT Id, IsDeleted FROM Account WHERE IsDeleted=true

<QueryResult>
  <done>true</done>
  <totalSize>0</totalSize>
</QueryResult>

 

SELECT Id, IsDeleted FROM Account WHERE IsDeleted=true ALL ROWS

<Errors>
  <Error>
    <errorCode>MALFORMED_QUERY</errorCode>
    <message>ALL ROWS not allowed in this context</message>
  </Error>
</Errors>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AdminBoosterAdminBooster

Rest API is for another usage than Soap API.

For data replication / sync, you have to use the Soap Api, beacuse you have dedicated verbs for this : getDeleted, get Updated, capability to query on deleted records...

Think about using the Rest Api for single record usage by a final user. For instance, if you are developing a mobile app, Rest Api would be appropriate

All Answers

AdminBoosterAdminBooster

You can't retrive deleted records using the REST Api

Sailor67Sailor67

Just to double check, are you absolutely sure..?

 

I just can't see why it wouldn't be possible since Salesforce obviously wants us to use their API and promote their service as much as possible service via apps. What would the reason be? My app needs to sync changed/deleted items and it is crucial to be able to retrieve only deleted items.

AdminBoosterAdminBooster

Rest API is for another usage than Soap API.

For data replication / sync, you have to use the Soap Api, beacuse you have dedicated verbs for this : getDeleted, get Updated, capability to query on deleted records...

Think about using the Rest Api for single record usage by a final user. For instance, if you are developing a mobile app, Rest Api would be appropriate

This was selected as the best answer
Sailor67Sailor67

I am afriad it is a mobile app and I need the REST API.

 

But I still can't understand why it should'nt be possible to retreive deleted items. It's just a huge and unnessasary constraint in my oppinion

 

Anyway, many thanks for your comments

Guisim2Guisim2
+1 for QUERY ALL in Rest API
Sailor67Sailor67
Sorry, but I do not understand..
Guisim2Guisim2
As you already know, queryAll() is the method that allows you to retrieve deleted items.

It is not available in the REST API.
I've encountered the same limitation. I simply wanted to give you my +1.

There quite a few requests for this on the forums
http://boards.developerforce.com/t5/APIs-and-Integration/Query-All-using-REST-API/td-p/354341

The "ALL ROWS" keyword would work as well.
Sailor67Sailor67

I see thanks.

 

Yes, there seems to be more users wanting this feature, especially for sync..

 

Please Salesforce, why can't you upgrade with such an essential detail? Many developers want to go for the pure HTTP REST and not the SOAP and in mobile apps particularily. I think you will cover 95% of all cases if only soft deleted records are shown but no hard deleted. A big step on the way.