Bearbeiten

Teilen über


Web services best practices

This article provides recommendations that you can implement to make your web services applications faster and easier to understand and maintain.

Recommendation Example
Performance of web services is both the responsibility of the Business Central server endpoint and the consumer (the client). Visit the Business Central web services performance tuning guide to learn how to make web services fast and stable. Read more at Web Services Performance
Use the HTTPS protocol to send data between Business Central and the web service consumer. The examples in this section use the HTTP protocol to illustrate the setup, but we recommend that your solution uses transport-level security. In the application that consumes the Business Central web service, require that URIs are accessed by using HTTPS. For example, a more secure URI for the OData web services on your local computer is https://localhost:7048/BC230/ODataV4/.
Use singular forms of names. This provides meaningful singular entity names in the generated proxy classes. When publishing page 21, Customer Card, use Customer as the service name instead of Customers or CustomerCard.
Avoid using spaces and other characters because they're transformed to underscores or other characters that may not be displayed as you want and could lead to ambiguity. When publishing page 42, Sales Order, remove the space and use SalesOrder as the service name.
Use Pascal casing when you combine words. Pascal casing capitalizes the first character of each word, including acronyms and initialisms that are more than two letters long. Use SalesOrder or ContactPerson as the service name.

Tip

If the same code needs to run both in the UI but also in the background (in a scheduled task or with a job queue entry) or in a web service call (SOAP/OData/API), then use if GuiAllowed() then calls to encapsulate AL code that interact with the user. Learn more in System.GuiAllowed() Method.

See also

Web Services Overview
Writing fast Web Services