Skip to main content
Skip table of contents

Testing BC Requests in Visual Studio Code

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 =
@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{{tenantId}}/oauth2/v2.0/token HTTP/1.1
Content-type: application/x-www-form-urlencoded


### 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}}

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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.