Business Central lets you publish pages and codeunits as web services, making them accessible to external applications. There are two protocols available: OData (used for data access and list-style integrations) and SOAP (used for calling codeunit functions). Both are available in cloud and on-premises deployments.
For new integrations, API pages are the recommended approach for read/write data access, they follow a cleaner OData v4 standard. Web services are still useful when you need to expose custom logic via SOAP, or when integrating with older systems that consume OData v3.
Navigating to Web Services
- Search for Web Services using
Alt + Q. - The page lists all currently published services. Each row shows the object type, object name, service name, and whether it is published.
Publishing a Page as an OData Web Service
- On the Web Services page, select New to add a row.
- Set Object Type to
Page. - Set Object ID to the page number you want to expose, for example,
21for the Customer Card or22for the Customer List. - Enter a Service Name. This becomes part of the URL, so keep it short and descriptive (e.g.
Customers). - Check the Published checkbox.
- The OData URL will appear in the OData URL column once the row is saved.
The OData URL follows this pattern for cloud environments:
https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environment}/ODataV4/{ServiceName}?company={CompanyName}
For on-premises, the URL uses your server hostname instead.
Publishing a Codeunit as a SOAP Web Service
SOAP services are used when you need external systems to call specific functions defined in a codeunit.
- On the Web Services page, select New.
- Set Object Type to
Codeunit. - Set Object ID to the codeunit number.
- Enter a Service Name.
- Check Published.
The SOAP URL will appear in the SOAP URL column. External callers can consume the WSDL from that URL to discover available functions and their parameters.
Consuming a Web Service from an External Application
How you consume the service depends on the protocol:
OData: Make HTTP GET or POST requests to the OData URL. You can use tools like Postman, Power Query, or any HTTP client. The service returns JSON or XML depending on the Accept header you send.
SOAP: Import the WSDL into your application (for example, using Visual Studio’s “Add Service Reference” or a SOAP client library). The generated client will expose the codeunit’s functions as callable methods.
Authentication
All web service calls require authentication. Business Central supports:
- OAuth 2.0, required for cloud environments. Use an Azure AD app registration to obtain a bearer token.
- Basic Auth with web service access key, available for on-premises and supported in cloud for backward compatibility. The web service access key is generated on the User Card under Web Service Access Key.
Avoid using Basic Auth in new integrations if your environment supports OAuth 2.0.
Notes on OData Web Services vs. API Pages
OData web services expose the full page object, including all fields visible on the page. API pages are purpose-built for integration and expose a defined, stable set of fields. If you are building a new integration that reads or writes master data (customers, vendors, items), use an API page rather than a web service. Web services remain the right choice for SOAP-based integrations and for quick access to data from specific pages that do not have a corresponding API page.
To build a more structured read/write integration using the Business Central REST API, see How to Use APIs in Business Central.