Skip to content
AndiDog edited this page Jan 31, 2012 · 4 revisions

ServiceStack supports 6 response formats out of the box:

  • JSON
  • XML
  • JSV (hybrid CSV-style escaping + JSON format that is optimized for both size and speed)
  • HTML 5 (provides a readable and semantic HTML layout letting you visualize all the data returned by your web service)
  • CSV
  • Markdown Razor (Razor combined with markdown)

Rest endpoint

You can define which format should be used by adding ?format={format} to the end of the URL.

  • ?format=json
  • ?format=xml
  • ?format=jsv
  • ?format=csv
  • ?format=html

Example: http://www.servicestack.net/ServiceStack.Hello/servicestack/hello/World!?format=json

Alternatively ServiceStack also recognizes which format should be used with the Accept http header:

  • Accept: application/json
  • Accept: application/xml

As you can see, this approach only works with json and xml.

Default endpoint

/servicestack/[xml|json|html|jsv|csv]/[syncreply|asynconeway]/[servicename]

Examples:

  • /servicestack/xml/[syncreply|asynconeway]/[servicename] will be XML
  • /servicestack/json/[syncreply|asynconeway]/[servicename] will be JSON

SOAP endpoint

The SOAP endpoint only supports XML of course.

Tip: If you have forgotten the details about the specific endpoints, you can re-read this tutorial

Clone this wiki locally