OpenAPI Specification for Dynamics 365 Business Central

Standard APIs for Business Central are available as an OpenAPI Specification (OAS). OAS defines a standard interface to RESTful APIs, providing a uniform access to APIs and documentation.

Previewing the OpenAPI contract

There are extensions for Visual Studio Code that enable previewing and editing. SwaggerHub enables previewing and editing online.

To run SwaggerUI locally, node.js can be used to serve the SwaggerUI, by following the steps below:

  1. Download OAS for Business Central as shown above.

  2. Install Node.js.

  3. Copy the javascript code shown below and save it to a file with the filename BC_OAS.js.

    const express = require('express');
    const app = express();
    const port = 3000;
    const swaggerUi = require('swagger-ui-express');
    const YAML = require('yamljs');
    const swaggerDocument = YAML.load('./BCOAS1.0.yaml'); 
    
    //const swaggerDocument = require('./BCOAS1.0.json');
    
    var options = { };
    app.use('/', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));
    app.listen(port, () => console.log(`Swagger UI for Business Central listening on port ${port}!`))
    
  4. Install the required node packages by running npm from the command line:

    npm install express swagger-ui-express yamljs
    
  5. Run the node app created. From the command line run the following:

    node BC_OAS.js
    
  6. Browse to https://localhost:3000.

  7. To use Try it out authorization in SwaggerUI, an Azure Active Directory app must be created. Follow these steps to create an AAD app, with access to Business Central. Copy and paste the client ID from the AAD app into the authorization dialog of SwaggerUI.

Note

For OAuth2 testing purposes, a multi-tenant AAD app has been created. Admin consent is needed. Client ID : 060af3ac-70c3-4c14-92bb-8a88230f3f38.

See Also

Developing Connect Apps for Dynamics 365 Business Central