Find your content:

Search form

You are here

Can you use the LIKE operator in SOQL queries via the REST API?


As the title states, can you use LIKE in SQOL queries via the REST API?

Even with this basic query:

select Id from Account  where BillingState like 'VIC%' 

I'm getting an error back:

REST Response fault: [{"message":"SOQL statements cannot be empty or null","errorCode":"MALFORMED_QUERY"}]

Am I missing something obvious here?

Attribution to: Matt Lacey

Possible Suggestion/Solution #1

Yes you can. SOQL in the rest API supports all the same constructs that its SOAP older brother does. Remember to pass the SOQL as the 'q' parameter in the URL,and to URLEncode the soql when putting it in the query, e.g.

Attribution to: superfell

Possible Suggestion/Solution #2

I think the issue is with the url encoding of the % in the like clause.

I just tried the following in the Workbench Rest API and it worked.


Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content