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
benvkbenvk 

Query All using REST API

I want to get deleted records similar to the way the Soap library .queryAll() works, or the way the [ Select ... QUERY ALL ] works in Apex. Is there a way of doing this using the rest api?

 

I've tried a few different things without any luck:

 

"/services/data/v23.0/query/?q=Select ... QUERY ALL"

"/services/data/v23.0/queryAll/?q=Select ... "

"/services/data/v23.0/query_all/?q=Select ... "

 

so for now I'm back to soap :(

 

 

Thanks

 

Ben

Best Answer chosen by Admin (Salesforce Developers) 
Pat PattersonPat Patterson

Hi benvk,

 

The ALL ROWS/queryAll() functionality is not currently available in the REST API. Sorry.

 

Cheers,

 

Pat

All Answers

Pat PattersonPat Patterson

Hi benvk,

 

The ALL ROWS/queryAll() functionality is not currently available in the REST API. Sorry.

 

Cheers,

 

Pat

This was selected as the best answer
SuperfellSuperfell

You can't do this in the REST API, what in paticular are you trying to do? if you doing data replication/synchronization, then you should be using getDeleted instead to detect deleted records, there are many situations where a deleted record will be hard deleted and not appear in a queryAll call, but getDeleted will still correctly identify that those records were deleted.

benvkbenvk

Yes, i need deleted records for synchronisation. Good point - I didn't realise that QueryAll didn't pick up hard deleted items. 

 

But still, there's no rest api for this, is there? I also can't find any reference to calling getDeleted in apex, only in the soap API - so i can't even wrap the functionality in a custom rest api. Surely I'm missing something? Otherwise I'm back to using the soap api.

 

Thanks

Ben

TassTass

Try issuing a SOQL query on the object you want to retrieve where IsDeleted is true

YoxelYoxel

 This does not seem to return recycle bin objects:

SELECT * FROM Contact WHERE isDeleted=true

 

I also tried to get recently modified objects with

SELECT * FROM Contact WHERE  SystemModstamp>{some past date}

 

 but recently deleted objects are not rturned this way either :(

 

 Is there any way to retrieve those recycle bin objects using RESTful API?

 

-Alexey

SuperfellSuperfell

Not currently.

Robert LongRobert Long
So it's been some 3 years since this post.
Have we figured out the clear easy way to SELECT * in a REST way?

Example I'm looking for - I have:
/services/data/v36.0/query/?q=SELECT+name+from+Contact
<!---As we all know I can add any field +name+firstname+lastname+ etc...etc...---->

How can I just select all fields in the CONTACT sobject without having to type them out?

ADDED PERK
Does anyone know how to add the WHERE clause?

Thank you everyone for your expertise -- We're all in this together and I couldn't get better without you all.

Rob Long