Edit on GitHub

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:

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

Example: http://test.servicestack.net/hello/World!?format=json

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

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

Pre-defined Routes



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.