First time post here and I'm quite new to the SF ecosystem as well. I'm currently trying to figure out how to properly form queries using SOQL + REST.
Ideally what I am trying to do is query an endpoint like:
services/data/v37.0/?q=SELECT+Opportunities+WHERE+id+LIKE+'ID_NUMBER'
I've read a few different ways to go about doing this, but I'm not sure if creating a query like this is the best way, or it using the query() endpoint is better.
I'm just looking for some guidance on pulling back open opportunities at this point.
Best Answer
Your query does not use valid syntax. There are a few things you need to fix:
SELECT
clause must contain a comma delimited list of fields to returnFROM
clause that tells the system which object to queryOpportunity
, notOpportunties
LIKE
clause on Id values. If you have an exact value to filter on, use=
Opportunity
records, filter on theIsClosed
field.If you're going to use the REST API, note also from Execute a SOQL Query in the
Force.com REST API Developer Guide
that you have a couple more issues you need to fix in your endpoint path:/query/
after the version (i.e./v37.0
/query/
?q=...
)/
services/...
)Putting it all together, you are looking for something along these lines: