Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Users discover web services by pointing a browser at the computer that is running Business Central Server and requesting a list of available services. When you publish a web service, it's immediately available over the network for authenticated users. All authorized users have access to metadata for Business Central web services, but only users who have sufficient Business Central permissions can access actual data.
Depending on the type of web service (API, OData, or SOAP), the web service might need to be published to be available for users.
If the API stack has been enabled for the Business Central environment, then no additional setup is needed to make an API web service available.
The API stack is enabled by default in Business Central online. For more information on how to enable APIs for on-premises environments, please visit Enabling the APIs for Dynamics 365 Business Central.
You can set up a SOAP or OData based web service in the client. You must then publish the web service so that it's available to service requests over the network.
The following steps explain how to create and publish a web service.
Open the client, such as a browser at https://businesscentral.dynamics.com/?.
Choose the icon, enter Web Services, and then choose the related link.
In the Web Services page, choose New.
In the Object Type column, select Codeunit, Page, or Query.
Note
Codeunit and Page are valid types for SOAP web services.
Page and Query are valid types for OData web services.
In the Object ID column, select the object ID of the object that you want to expose. For example, to expose the customer card as a web service, enter 21.
If the database contains multiple companies, you can choose an object ID that is specific to one of the companies.
In the Service Name field, assign a name to the web service. For example, if you expose the customer card as a web service, enter Customers.
Select the check box in the Published column.
When you publish the web service, you see the URLs that are generated for the web service in the OData URL and SOAP URL fields. You can test the web service immediately by choosing the links in the OData URL and SOAP URL fields. Optionally, copy the value of the field and save it for later use.
After you publish a web service, it's available on the Business Central Server computer that you were connected to when you published. The web service is available across all Business Central Server instances running on the server computer.
You can verify the availability of that web service by using a browser. Or choose the link in the OData URL and SOAP URL fields in the Web Services page. The following procedure illustrates how you can verify the availability of the web service for later use.
Note
For page objects published as OData, there are two extra settings: Exclude Non-Editable FlowFields and Exclude Fields Outside of the Repeater. These settings exclude non-editable FlowFields and fields outside of the page's repeater control from eTag calculations. Excluding these fields can prevent problems when users edit multiple lines, for example, in Excel. The settings are hidden on the Web Services page by default. To show them, use personalization.
In your browser, enter the relevant URL. The following table illustrates the types of URLs that you can enter. For SOAP web services, use the following format for your URI.
Web service type | Syntax | Example |
---|---|---|
API | See Endpoints for the APIs for Dynamics 365 Business Central On-Premises and Online | |
OData | https://Server:ODataWebServicePort/ServerInstance/OData/Company('CompanyName') | https://localhost:7048/BC210/ODataV4/Company('CRONUS International Ltd.') |
OData | https://Server:ODataWebServicePort/ServerInstance/OData/Company(Id=guid) | https://localhost:7048/BC210/ODataV4/Company(Id=a4bc6898-4591-4cf7-9990-293a0a0d66b7) |
SOAP | https://Server:SOAPWebServicePort/ServerInstance/WS/CompanyName/services/ | https://localhost:7047/BC210/WS/CRONUS International Ltd./services/ |
The company name is case-sensitive. For OData, it is recommended to use the Company(Id=guid) syntax as the company ID is immutable, whereas the company name can be changed by an administrator.
Review the information that is displayed in the browser. Verify that you can see the name of the web service that you've created.
When you access a web service, and you want to write data back to Business Central, you must specify the company name or company id. You can specify the company as part of the URI as shown in the examples. Or you can specify the company as part of the query parameters. For example, the following URIs point to the same OData web service endpoint and are all valid URIs.
Recommended syntax:
https://localhost:7048/<serverinstance>/ODataV4/Company(Id=a4bc6898-4591-4cf7-9990-293a0a0d66b7)/Customer
Alternative syntax (also supported):
https://localhost:7048/<serverinstance>/ODataV4/Company('CRONUS International Ltd.')/Customer
https://localhost:7048/<serverinstance>/ODataV4/Customer?company='CRONUS International Ltd.'
To unpublish a webs service, clear the Published check box. This step will make the web service inaccessible.
Important
When you unpublish a web service that is marked for All Tenants, other web services that use the same object will be automatically unpublished, even though the Published check box is still selected for these web services.
Avoid using standard UI pages to expose as web service endpoints. Many things, such as fact boxes, aren't returned in web service results, but use resources to prepare. Instead, define and use API pages/queries for your web service integrations.
For more information, see Web services performance.
Should you need a unique row identifier in your OData or SOAP web service endpoint, then consider adding the SystemId field to the page. The SystemId field is a GUID data type field that specifies a unique, immutable (read-only) identifier for records in the table.
For more information, see System Fields.
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Work with web services in Dynamics 365 Business Central - Training
Use SOAP and OData to read and update records, and handle UI interaction in Business Central.
Certification
Microsoft Certified: Dynamics 365 Business Central Developer Associate - Certifications
Demonstrate you have the skills to design, develop, test, and maintain solutions based on Dynamics 365 Business Central.