forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Formats
mythz edited this page Oct 28, 2012
·
5 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/json
Accept: 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 article
- Why ServiceStack?
- What is a message based web service?
- Advantages of message based web services
- Why remote services should use separate DTOs
- Getting Started
- Reference
- Clients
- Formats
- View Engines 4. Razor & Markdown Razor
- Hosts
- Advanced
- Configuration options
- Access HTTP specific features in services
- Logging
- Serialization/deserialization
- Request/response filters
- Filter attributes
- Concurrency Model
- Built-in caching options
- Built-in profiling
- Messaging and Redis
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- Plugins
- Tests
- Other Languages
- Use Cases
- Performance
- How To
- Future