Skip to main content

ApiHandlers

Add a new API Handler at a custom route.

RawHttpHandlers.Add(ApiHandlers.Json("/api/{Request}")) => delegates /api/* requests to JSON Request Handler, e.g:

  • /api/Hello => {"result":"Hello"}
  • /api/Hello?name=World => {"result":"Hello, World"}
Assembly: ServiceStack.dll
View Source
Declaration
public static class ApiHandlers

Methods

Json(String)

View Source
Declaration
public static Func<IHttpRequest, HttpAsyncTaskHandler> Json(string apiPath)
Returns

System.Func<ServiceStack.Web.IHttpRequest,ServiceStack.Host.Handlers.HttpAsyncTaskHandler>

Parameters
TypeName
System.StringapiPath

Jsv(String)

View Source
Declaration
public static Func<IHttpRequest, HttpAsyncTaskHandler> Jsv(string apiPath)
Returns

System.Func<ServiceStack.Web.IHttpRequest,ServiceStack.Host.Handlers.HttpAsyncTaskHandler>

Parameters
TypeName
System.StringapiPath

Csv(String)

View Source
Declaration
public static Func<IHttpRequest, HttpAsyncTaskHandler> Csv(string apiPath)
Returns

System.Func<ServiceStack.Web.IHttpRequest,ServiceStack.Host.Handlers.HttpAsyncTaskHandler>

Parameters
TypeName
System.StringapiPath

Xml(String)

View Source
Declaration
public static Func<IHttpRequest, HttpAsyncTaskHandler> Xml(string apiPath)
Returns

System.Func<ServiceStack.Web.IHttpRequest,ServiceStack.Host.Handlers.HttpAsyncTaskHandler>

Parameters
TypeName
System.StringapiPath

Generic(String, String, RequestAttributes, Feature)

View Source
Declaration
public static Func<IHttpRequest, HttpAsyncTaskHandler> Generic(string apiPath, string contentType, RequestAttributes requestAttributes, Feature feature)
Returns

System.Func<ServiceStack.Web.IHttpRequest,ServiceStack.Host.Handlers.HttpAsyncTaskHandler>

Parameters
TypeName
System.StringapiPath
System.StringcontentType
ServiceStack.RequestAttributesrequestAttributes
ServiceStack.Featurefeature