I'm sending a GET request to

{orgname}.crm.dynamics.com/api/data/v9.1/accounts(accountGuid)$select=_primarycontactid_value

and getting an error:

Bad Request - Error in query syntax

I'm using the query syntax I found here https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/247815/how-to-get-all-the-primary-contact-of-a-specific-account-through-api/688381

If I take off the $select parameter, I get a JObject with all of the attributes, I'm just not sure why the query syntax is wrong using that parameter. Any help is greatly appreciated.

1

There are 1 best solutions below

0
Arun Vinoth-Precog Tech - MVP On BEST ANSWER

Try this below as there is a typo in your snippet. Read more

{orgname}.crm.dynamics.com/api/data/v9.1/accounts(accountGuid)?$select=_primarycontactid_value

To avoid such errors, you can always use CRM REST builder to compose and test queries.

Note: I noticed it is not your mistake, I even corrected the snippet in original forum thread from Aric. :)