Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating RESTful API documentation from a WCF Service

Tags:

rest

wcf

I've recently started on a project to build out a RESTful API in WCF, and I'm going to need to expose documentation along with the API itself. I was hoping to leverage the XML code comments in my docs for this documentation.

But what I want to output is just the contracts that are exposed by the service: the endpoints and the JSON/XML object structures. Since I'm trying to create external documentation, I'm interested in any of the internals of my library, or how it ties into the .Net Framework (or even that it is .Net, for that matter).

What are my options for tools, to create these docs? I've heard that Sandcastle or Doxygen are good tools for generating docs from XML code comments, but can I filter away the classes and methods that I don't want to expose?

like image 446
Andrew Avatar asked Jul 31 '09 13:07

Andrew


People also ask

Is it possible to create RESTful services using WCF?

You can use WCF to build RESTful services in . NET. REST (Representational State Transfer) is an architecture paradigm that conforms to the REST architecture principles. The REST architecture is based on the concept of resources: It uses resources to represent the state and functionality of an application.

Why is Web API required Is it possible to use RESTful services using WCF?

Web API is open source an ideal platform for building RESTful services using the . NET Framework. Unlike a WCF REST service, it use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).

What is WCF RESTful service?

WCF stands for Windows Communication Foundation, it works based on Simple Object Access Protocol. REST stands for Representational State Transfer. REST supports cross-platform and exchange data in JSON and XML format and use the HTTP protocols (GET, POST, PUT, PATCH and DELETE)


2 Answers

I understand this question was asked pre-.NET 4.0, but as of .NET 4.0, you can create a 'help page' as as described in WCF Web HTTP Service Help Page.

WCF 4.0 Example

[System.ComponentModel.Description("Triggers Method Name Behavior.")]
public void MethodName() {}
like image 129
Rick Glos Avatar answered Sep 20 '22 10:09

Rick Glos


Sure, you can filter unwanted APIMembers with Sandcastle. This blogentry describes how. If you are new to Sandcastle, you might want to try out Sandcastle Help File Builder as well, which is basically a Sandcastle Frontend.

like image 30
tobsen Avatar answered Sep 22 '22 10:09

tobsen