O'Reilly logo

Mastering ServiceStack by Andreas Niedermair

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Querying your service with Swagger

Documenting your API is only one part of making it explorable, you can also offer a way to play with your API by generating requests and display their responses, along with the possibility to read through the documentation.

Therefore, Swagger, which is an advanced testing environment, is available for any ServiceStack service and can be enabled by adding the ServiceStack.Api.Swagger NuGet package to your solution. Additionally, you have to add a SwaggerFeature object to your host's configuration, as shown:

using Funq;
using ServiceStack;

public override void Configure(Container container)
{
  this.Plugins.Add(new SwaggerFeature());
}

This will offer a new link in the plugin section of the metadata page available at ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required