Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (57 sloc) 2.67 KB
slug title
Content Types

ServiceStack supports the following formats:

.NET Service Clients

The different Content Types can be easily consumed using ServiceStack's Typed Generic Service Clients.

HTTP/REST Endpoints

You can define which format should be used by adding a .{format} extension:

  • .json
  • .xml
  • .jsv
  • .csv
  • .html

Or by appending ?format={format} to the end of the URL:

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


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.

Pre-defined Routes



  • /json/reply/Hello (JSON)
  • /xml/oneway/SendEmail (XML)

Forcing a Content Type

Whilst ServiceStack Services are typically available on any endpoint and format, there are times when you only want adhoc Services available in a particular format, for instance you may only want the View Models for your dynamic Web Views available in HTML. This can now be easily enabled with the new [HtmlOnly] Request Filter Attribute, e.g:

public class HtmlServices : Service
    public object Any(MyRequest request) => new MyViewModel { .. };

This feature is also available for other built-in Content Types: [JsonOnly], [XmlOnly], [JsvOnly] and [CsvOnly].

SOAP Endpoint

Consume ServiceStack Services via SOAP using WCF Add Service Reference or ServiceStack generic SOAP Clients.

MQ Endpoint

Consume ServiceStack Services via Message Queue.