官术网_书友最值得收藏!

Documenting contracts

Unlike soap style messages where the Web Services Description Language (WSDL) defines a robust contract between the consumer and service provider as an XML document, there was no such metadata exchanged when consuming a REST service until WSDL 2.0 was released.

Textual documentation still seems to be popular with developers to describe the available methods and entities. There is a NuGet package available for MS Visual Studio, which automatically generates help page content for Web API projects. It can be installed using the Package Manager Console using the following command: PM> Install-Package Microsoft.AspNet.WebApi.HelpPage.

Swagger, which is an open source product is also very popular among developers for generating interactive documentation and client SDK generation and discoverability. More information can be found at http://swagger.io/. Swagger appears to be Microsoft's tool of choice for API documentation as it has been adopted in many products in the Azure suite.

Another tool is RESTful API Modeling Language (RAML), which provides a contract first approach of modeling web APIs. This uses a derivative of YAML (YAML ain't markup language) and JSON to create a human- and machine-readable document. More information can be found at http://raml.org/index.html.

To help the consumers of the service, the messages should be self-descriptive, and you should be able to understand the requests and responses after spending minimal time using the service and reading the documentation. In the end, the URL structure has a large part to play in the overall usability of the service.

主站蜘蛛池模板: 贵定县| 隆子县| 分宜县| 凤山县| 武安市| 泰顺县| 郑州市| 宜城市| 无为县| 华安县| 广德县| 枣庄市| 平遥县| 偏关县| 太和县| 都安| 武胜县| 九江县| 佛学| 平武县| 昭觉县| 正镶白旗| 金沙县| 襄垣县| 吴旗县| 夏津县| 洛隆县| 兰坪| 龙南县| 奎屯市| 休宁县| 麟游县| 陈巴尔虎旗| 林口县| 博爱县| 始兴县| 卓尼县| 台北县| 太原市| 建平县| 溧阳市|