Retrieving a Record using Web API by Id or Name in Dynamics 365

Leave a comment

In Dynamics 365, we can use the Web API to retrieve a record. We can do this by using the Id of the record, or another identifier such as the name.

Let’s use Accounts as an example.

To get a record using the Id, the format is:

https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts(Id)

Note there are no quotes around the Id.

For example:

https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts(D494B650-73FF-E611-8104-E0071B669E61)

Returns:

To get by name (accounts has a name field), we would use filter:

https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts?$filter=name eq ‘the name

E.g.

https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts?$filter=name eq ‘7-Eleven and Udaside label’

Returns:

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *