I have a list of Contact Ids in javascript and want to get the Contact records of the respective Ids from Salesforce using REST API but am not able to create the query using IN keyword as it is giving me an error. Bind variables only allowed in Apex code. How can I create a rest request to get the records with selected fields using these ids.

  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Aug 31, 2021 at 11:03

1 Answer 1


You are trying to use something like this: IN :idsSet, it is definitely allowed only in Apex, you need to concatenate ids in your variable to a string somehow like this:

"IN ('" + idsSet.join("', '") + "')"

You must log in to answer this question.