0

Possible Duplicate:
ASP.NET web api: documenting/specifying a service

I'm new to Asp.net Web API. It seems there is no formal definition of the input and outputs for the Web APIs, unlike SOAP-based ones where a WSDL document contains all the schema required for requests and responses to the service. I am very familiar to this concept due to my past experiences in WCF.

How a client knows how to consume those APIs ? Does we need to provide 'examples' ?

Community
  • 1
  • 1
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112

2 Answers2

1

I think your best bet is to go for ASP.NET Web API Help Page nuget package - http://nuget.org/packages/Microsoft.AspNet.WebApi.HelpPage. It's been released the same day as Web API RTM was released, that's why there is no so much info on the web about it yet, and why most people would still point you to IApiExplorer.

There is a really nice introduction screencast by Yao Huang from MSFT about how to use it - http://blogs.msdn.com/b/yaohuang1/archive/2012/08/15/introducing-the-asp-net-web-api-help-page-preview.aspx

It's not as low level as IApiExplorer (it operates on top of that) and should be more than fine for most use cases.

Also, if you are building a REST service do not use WSDL. It has not been designed to document REST services, and its much closer to RPC type of API.

Filip W
  • 27,097
  • 6
  • 95
  • 82
1

ApiExplorer is the way to go for Asp.net Webapi.

Since there is no WSDL or anything for REST Apis that can exactly tell the consuming client about the operations/ contract exposed. Webapi had IApiExplorer that can be used for generating documentation of your api

Tabish Sarwar
  • 1,505
  • 1
  • 11
  • 18