Click or drag to resize

IWebApi Methods

The IWebApi type exposes the following members.

Methods
  Name Description
Public method Code example AbandonAuthorization Stop the flow of initial authorization
Public method Code example CreateErrorResponse Create http error response with status code and message
Example
C#
var webApi = ctx.Use<IWebApi>();
webApi.CreateErrorResponse(401, "You are not authorized");
Public method CreateFileResponse(DocumentInfo, String, String) Create http file response with a given document info, media type and disposition header. The file can be downloaded or will be viewed in the browser client.
Public method Code example CreateFileResponse(String, ActionStream, String, String) Create http file response with a given file name with an action named as beginWritingStream. That action is called when an output stream is available, allowing the action to write to it directly. Thus, allow we can write a largest file (more than 1GB with controlling memory usage).
Public method CreateFileResponse(String, Byte, String, String) Create http file response with a given file name, file content, media type and disposition header. The file can be downloaded or will be viewed in the browser client.
Public method CreateFileResponse(String, Stream, String, String) Create http file response with a given file name, file stream, media type and disposition header. The file can be downloaded or will be viewed in the browser client.
Public method CreateFileResponse(String, String, String, String) Create http file response with a given file name, file path, media type and disposition header. The file can be downloaded or will be viewed in the browser client.
Public method Code example CreateResponseT Create http response with data
Example
C#
var webApi = ctx.Use<IWebApi>();
var data = new { FirstName = "Thao", LastName = "Dinh" };        
webApi.CreateResponse(data);
Public method CreateTextResponse Create http response with text data
Public method GetBrowserAgent Get the complete user-agent string of the client
Public method Code example GetHeaders Get headers from the current request
Example
C#
var webApi = ctx.Use<IWebApi>();        
var headers = webApi.GetHeaders();
Public method Code example GetQueryString Get query string from the current request
Example
C#
var webApi = ctx.Use<IWebApi>();        
var queryString = webApi.GetQueryString();
Public method Code example GetUri Get URI from the current request
Example
C#
var webApi = ctx.Use<IWebApi>();        
var uri = webApi.GetUri();
Public method GetUserIp Get current user ip
Public method Code example Redirect Redirect the specific url
Example
C#
var webApi = ctx.Use<IWebApi>();        
webApi.Redirect("https://api-local.casewhere.com/external/v0.1/trigger/kk-nemlogin-logout-callback?nonce=b3c7c6ea-f38a-4b2a-aa6e-9c69fce65ec1");
Top
See Also