Leverage Visual Studio Code to expedite testing endpoints. Install the Rest Client for Visual Studio Code extension.

Copy the code snippet below and paste into a new document in Visual Studio Code. Provide values for your environment specific values for Tenant ID, Client ID, Client Secret, and Environment Name.

@tenantId = xxxx
@clientId = xxxx
@clientSecret = xxxx
@baseUri = https://api.businesscentral.dynamics.com
@scope = {{baseUri}}/.default
@bcEnvironmentName = sandbox
@url = {{baseUri}}/v2.0/{{bcEnvironmentName}}/api/v2.0

### Define entity, like customers, items, or vendors
@entityName = purchaseOrders 

# @name auth
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1
Content-type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id={{clientId}}
&client_secret={{clientSecret}}
&scope={{scope}}

### Variable Response
@accessHeader = Bearer {{auth.response.body.$.access_token}}

# @name GetCompanies
GET {{url}}/companies HTTP/1.1
Authorization: {{accessHeader}}

### Variable Response
@companyId = {{GetCompanies.response.body.value.[0].id}}
@companyUrl = {{url}}/companies({{companyId}})
@displayName = MyItemDisplayName2


### Get entities
# @name GetEntities
GET {{companyUrl}}/{{entityName}} HTTP/1.1
Authorization: {{accessHeader}}
HTML

In VS code, you will notice links for Send Request:

Clicking Send Request will execute the request and allow you to see the responses for any troubleshooting needs.