The Dynamics 365 WebApi can be accessed through a web browser. This can be useful if you are writing code and want to see what the WebApi is returning.
To access the WebApi, go to your Dynamics 365 instance and the version of the WebApi you would like to access. For example, to access the 9.0 WebApi, the url would be:
https://yourorg.crm.dynamics.com/api/data/v9.0/
You can see this returns a list of entities in the system:
To access an entity such as Contacts, we can add it to the URL. This displays all contacts:
Select
Now let’s limit this to one field, the contact firstname:
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=firstname
We can add multiple fields, comma separated. Let’s select:
- First Name
- Last Name
- Birthdate
- City
Top
To select top, we can use:
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=firstname,lastname,address1_city,birthdate&$top=10
Filter
To filter, we can use:
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=firstname,lastname,address1_city,birthdate&$top=10&$filter=firstname eq ‘Jim’
This then translates to:
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=firstname,lastname,address1_city,birthdate&$top=10&$filter=firstname%20eq%20%27Jim%27
To filter on birthdate, use (note no quotes):
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=fullname,birthdate&$top=100&$filter=birthdate eq 1977-06-17
Order By
Some data types allow for Order By. We will order by the postal code.
https://yourorg.crm.dynamics.com/api/data/v9.0/contacts?$select=address1_postalcode&$top=10&$orderby=address1_postalcode
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL