How to set up an API

How to create an API

To find out how to create an API for Wiise, check out Welcome to the API(v2.0) for Business Central.

How to access API endpoints

APIs in Wiise are automatically enabled. The common endpoint services for Wiise APIs are below. Enter the below URL, insert your tenant id where specified on your internet browser.

    • Production: [https://wiise.api.bc.dynamics.com/v2.0/[tenant id]/production/api/v2.0]
    • Sandbox: [https://wiise.api.bc.dynamics.com/v2.0/[tenant id]/sandbox/api/v2.0]

Here's more information on How to enable and access API endpoints on Microsoft Docs.

How to retrieve data using the Common Data Service

To retrieve data for an entity set, Wiise APIs use the Common Data Service as explained in Query Data using the Web API.

For example, here's how you'd retrieve an Item ID by Item No.:

[https://wiise.api.bc.dynamics.com/v2.0/[tenant id]/[production/sandbox]/api/v2.0/companies([company id])/items?$select=id&$filter=number eq '1906-S']

 

How to test an API

1. You can access the APIs using any library of your choosing. We use Postman for this purpose.

2. Open Postman and create a new Get request by typing this URL on your internet browser: [https://wiise.api.bc.dynamics.com/v2.0/[tenant_id]/[production/sandbox]/api/v2.0/companies]

3. Configure OAuth and create an access token

    1. Under the Authorization tab, set Type to OAuth 2.0.
    2. Under Add authorization data to, choose Request Headers.
    3. Enter a Token Name.
    4. Under Grant Type, choose Client Credentials.
    5. Under Access Token URL, enter: [https://login.microsoftonline.com/[tenant_id]/oauth2/v2.0/token]
    6. Your Client ID is the Application (client) ID you copied from the Azure Active Directory app.
    7. Your Client Secret is the client secret Value you copied from the Azure Active Directory app.
    8. Under Scope, enter: [https://api.businesscentral.dynamics.com/.default in the field].
    9. Under Client Authentication, choose Send Client Credentials in body.
    10. Select Get New Access Token.
    11. Choose Use Token.

Send your API requests

You can now send your request.

 

Additional Information

  1. Find out more about Using Service to Service Authentication - Business Central | Microsoft Docs from Microsoft Docs.
  2. Find out more about Using OAuth to Authorize Business Central Web Services (OData and SOAP) from Microsoft Docs.

How to authenticate with Wiise APIs

The ability to access Web Services, including APIs, via the Web Service Access Key is being removed by Microsoft from Business Central version 20.1. OAuth v2.0 will be the new authentication method going forward.  

Wiise uses Azure Active Directory to issue and manage access tokens. These access tokens can be used to connect to Wiise Web Services.

 

Links to assist developers with APIs

How to connect to your APIs to authenticate

For information on how to get started developing APIs, go to:

Getting Started Developing Connect Apps for Dynamics 365 Business Central 

If you're having trouble connecting to the API, take a look at the steps here:

  1. Use the Basic Authentication to the end of the API.  
  2. An Azure Active Directory (AAD) user will need to access the API and authenticate your account.
    1. The Postman can then allow API testing to make sure you can get access to the API using your AAD account.
    2. The Postman will show you the specific error if you're unable to connect successfully.

How to install Microsoft V2 API in Wiise

To enable Microsoft's V2 APIs in Wiise, you'll need to install the MS_Exclude_APIV2 extension in Wiise.

Here's how.

  1. From the Wiise landing page on top right-hand search icon, search for and select Available Extensions.
  2. Search for and select MS_Exclude_APIV2 from the list of available extensions.
  3. Select Manage, then Install.

If MS_Exclude_APIV2 cannot be found in the Available Extensions page, then please contact Wiise Support.