forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Formats
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)
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/jsonAccept: application/xml
As you can see, this approach only works with json and xml.
/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
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