Assembly: RestSharp Namespace: RestSharp Class DeserializationException
Inheritance ↳ object
↳ System.Exception
Syntax Constructor DeserializationException(IRestResponse, Exception)
Syntax Parameters Name Type Description response
RestSharp.IRestResponse
innerException
System.Exception
Property Response
Syntax Enum ParameterType
Types of parameters that can be added to requests
Syntax Fields Name Description Cookie Cookie parameter GetOrPost UrlSegment HttpHeader RequestBody QueryString QueryStringWithoutEncode
Data formats
Syntax Fields Name Description Json Xml None
Enum Method
HTTP method to use when making requests
Syntax Fields Name Description GET POST PUT DELETE HEAD OPTIONS PATCH MERGE COPY
Format strings for commonly-used date formats
Syntax Field ISO_8601
.NET format string for ISO 8601 date format
Syntax Field ROUND_TRIP
.NET format string for roundtrip date format
Syntax Enum ResponseStatus
Status for responses (surprised?)
Syntax Fields Name Description None Completed Error TimedOut Aborted
Class FileParameter
Container for files to be uploaded with requests
Inheritance ↳ object
Syntax Property ContentLength
The length of data to be sent
Syntax Property Writer
Provides raw data for file
Syntax Property FileName
Name of the file to use when uploading
Syntax Property ContentType
MIME content type of file
Syntax Property Name
Name of the parameter
Syntax Method Create(String, Byte[], String, String)
Syntax Parameters Name Type Description name
string
data
byte[]
filename
string
contentType
string
Returns Type Description RestSharp.FileParameter
Method Create(String, Byte[], String)
Syntax Parameters Name Type Description name
string
data
byte[]
filename
string
Returns Type Description RestSharp.FileParameter
Method Create(String, Action<Stream>, Int64, String, String)
Syntax Parameters Name Type Description name
string
writer
System.Action<System.IO.Stream>
contentLength
long
fileName
string
contentType
string
Returns Type Description RestSharp.FileParameter
Class Http
HttpWebRequest wrapper (async methods)
Inheritance ↳ object
Syntax Method AsPostAsync(Action<HttpResponse>, String)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
httpMethod
string
Returns Type Description HttpWebRequest
Method AsGetAsync(Action<HttpResponse>, String)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
httpMethod
string
Returns Type Description HttpWebRequest
Constructor Http()
Syntax Property HasParameters
True if this HTTP request has any HTTP parameters
Syntax Property HasCookies
True if this HTTP request has any HTTP cookies
Syntax Property HasBody
True if a request body has been specified
Syntax Property HasFiles
True if files have been set to be uploaded
Syntax Property AutomaticDecompression
Syntax Always send a multipart/form-data request - even when no Files are present.
Syntax Property UserAgent
Syntax Property Timeout
Syntax Property ReadWriteTimeout
Syntax Property Credentials
Syntax Property CookieContainer
Syntax Property AdvancedResponseWriter
Syntax Property ResponseWriter
Syntax Property Files
Syntax Property FollowRedirects
Syntax Property Pipelined
Syntax Property ClientCertificates
Syntax Property MaxRedirects
Syntax Property UseDefaultCredentials
Syntax Property ConnectionGroupName
Syntax Property Encoding
Syntax Syntax Property Parameters
Syntax Property Cookies
Syntax Property RequestBody
Syntax Property RequestContentType
Syntax Property RequestBodyBytes
Syntax Property Url
Syntax Property Host
Syntax Property AllowedDecompressionMethods
Syntax Property PreAuthenticate
Syntax Property UnsafeAuthenticatedConnectionSharing
Syntax Property Proxy
Syntax Property CachePolicy
Syntax Property RemoteCertificateValidationCallback
Callback function for handling the validation of remote certificates.
Syntax Property WebRequestConfigurator
Syntax Method Create()
Syntax Returns Type Description RestSharp.IHttp
Method CreateWebRequest(Uri)
Syntax Parameters Name Type Description url
Uri
Returns Type Description HttpWebRequest
Method Post()
Execute a POST request
Syntax Returns Type Description RestSharp.HttpResponse
Method Put()
Execute a PUT request
Syntax Returns Type Description RestSharp.HttpResponse
Method Get()
Execute a GET request
Syntax Returns Type Description RestSharp.HttpResponse
Method Head()
Execute a HEAD request
Syntax Returns Type Description RestSharp.HttpResponse
Method Options()
Execute an OPTIONS request
Syntax Returns Type Description RestSharp.HttpResponse
Method Delete()
Execute a DELETE request
Syntax Returns Type Description RestSharp.HttpResponse
Method Patch()
Execute a PATCH request
Syntax Returns Type Description RestSharp.HttpResponse
Method Merge()
Execute a MERGE request
Syntax Returns Type Description RestSharp.HttpResponse
Method AsGet(String)
Execute a GET-style request with the specified HTTP Method.
Syntax Parameters Name Type Description httpMethod
string
The HTTP method to execute.
Returns Type Description RestSharp.HttpResponse
Method AsPost(String)
Execute a POST-style request with the specified HTTP Method.
Syntax Parameters Name Type Description httpMethod
string
The HTTP method to execute.
Returns Type Description RestSharp.HttpResponse
Syntax Parameters Name Type Description method
string
url
Uri
Returns Type Description HttpWebRequest
Method DeleteAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method GetAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method HeadAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method OptionsAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PostAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PutAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PatchAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method MergeAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Syntax Parameters Name Type Description method
string
url
Uri
Returns Type Description HttpWebRequest
Class HttpCookie
Representation of an HTTP cookie
Inheritance ↳ object
Syntax Comment of the cookie
Syntax Comment of the cookie
Syntax Property Discard
Indicates whether the cookie should be discarded at the end of the session
Syntax Property Domain
Domain of the cookie
Syntax Property Expired
Indicates whether the cookie is expired
Syntax Property Expires
Date and time that the cookie expires
Syntax Property HttpOnly
Indicates that this cookie should only be accessed by the server
Syntax Property Name
Name of the cookie
Syntax Property Path
Path of the cookie
Syntax Property Port
Port of the cookie
Syntax Property Secure
Indicates that the cookie should only be sent over secure channels
Syntax Property TimeStamp
Date and time the cookie was created
Syntax Property Value
Value of the cookie
Syntax Property Version
Version of the cookie
Syntax Class HttpFile
Container for HTTP file
Inheritance ↳ object
Syntax Property ContentLength
The length of data to be sent
Syntax Property Writer
Provides raw data for file
Syntax Property FileName
Name of the file to use when uploading
Syntax Property ContentType
MIME content type of file
Syntax Property Name
Name of the parameter
Syntax Representation of an HTTP header
Inheritance ↳ object
Syntax Creates a new instance of HttpHeader
Syntax Parameters Name Type Description name
string
Header name value
string
Header value
Creates a new instance of HttpHeader. Remember to assign properties!
Syntax Property Name
Name of the header
Syntax Property Value
Value of the header
Syntax Class HttpParameter
Representation of an HTTP parameter (QueryString or Form value)
Inheritance ↳ object
Syntax Property Name
Name of the parameter
Syntax Property Value
Value of the parameter
Syntax Property ContentType
Content-Type of the parameter
Syntax Class HttpResponse
Inheritance ↳ object
Syntax Constructor HttpResponse()
Syntax Property ContentType
Syntax Property ContentLength
Syntax Property ContentEncoding
Syntax Property Content
Syntax Property StatusCode
Syntax Property StatusDescription
Syntax Property RawBytes
Syntax Property ResponseUri
Syntax Property Server
Syntax Syntax Property Cookies
Syntax Property ResponseStatus
Syntax Property ErrorMessage
Syntax Property ErrorException
Syntax Property ProtocolVersion
Syntax Interface IHttp
Syntax Property ResponseWriter
The delegate to use to write the response instead of reading into RawBytes
Syntax Property AdvancedResponseWriter
The delegate to use to write the response instead of reading into RawBytes
Here you can also check the request details
Syntax Property CookieContainer
The to be used for the request
Syntax Property Credentials
to be sent with request
Syntax Property AutomaticDecompression
Enable or disable automatic gzip/deflate decompression
Syntax Always send a multipart/form-data request - even when no Files are present.
Syntax Property UserAgent
Syntax Property Timeout
Timeout in milliseconds to be used for the request
Syntax Property ReadWriteTimeout
The number of milliseconds before the writing or reading times out.
Syntax Property FollowRedirects
Whether or not HTTP 3xx response redirects should be automatically followed
Syntax Property Pipelined
Whether or not to use pipelined connections
Syntax Property ClientCertificates
X509CertificateCollection to be sent with request
Syntax Property MaxRedirects
Maximum number of automatic redirects to follow if FollowRedirects is true
Syntax Property UseDefaultCredentials
Determine whether or not the "default credentials" (e.g. the user account under which the
current process is running) will be sent along to the server.
Syntax Property Encoding
Encoding for the request, UTF8 is the default
Syntax HTTP headers to be sent with request
Syntax Property Parameters
HTTP parameters (QueryString or Form values) to be sent with request
Syntax Property Files
Collection of files to be sent with request
Syntax Property Cookies
HTTP cookies to be sent with request
Syntax Property RequestBody
Request body to be sent with request
Syntax Property RequestContentType
Content type of the request body.
Syntax Property PreAuthenticate
Flag to send authorisation header with the HttpWebRequest
Syntax Property UnsafeAuthenticatedConnectionSharing
Flag to reuse same connection in the HttpWebRequest
Syntax Property CachePolicy
Caching policy for requests created with this wrapper.
Syntax Property ConnectionGroupName
The ConnectionGroupName property enables you to associate a request with a connection group.
Syntax Property RequestBodyBytes
An alternative to RequestBody, for when the caller already has the byte array.
Syntax Property Url
URL to call for this request
Syntax Property Host
Explicit Host header value to use in requests independent from the request URI.
If null, default host value extracted from URI is used.
Syntax Property AllowedDecompressionMethods
List of allowed decompression methods
Syntax Property Proxy
Proxy info to be sent with request
Syntax Property RemoteCertificateValidationCallback
Syntax Property WebRequestConfigurator
Syntax Method DeleteAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method GetAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method HeadAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method OptionsAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PostAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PutAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method PatchAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method MergeAsync(Action<HttpResponse>)
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
Returns Type Description HttpWebRequest
Method AsPostAsync(Action<HttpResponse>, String)
Execute an async POST-style request with the specified HTTP Method.
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
httpMethod
string
The HTTP method to execute.
Returns Type Description HttpWebRequest
Method AsGetAsync(Action<HttpResponse>, String)
Execute an async GET-style request with the specified HTTP Method.
Syntax Parameters Name Type Description action
System.Action<RestSharp.HttpResponse>
httpMethod
string
The HTTP method to execute.
Returns Type Description HttpWebRequest
Method Delete()
Syntax Returns Type Description RestSharp.HttpResponse
Method Get()
Syntax Returns Type Description RestSharp.HttpResponse
Method Head()
Syntax Returns Type Description RestSharp.HttpResponse
Method Options()
Syntax Returns Type Description RestSharp.HttpResponse
Method Post()
Syntax Returns Type Description RestSharp.HttpResponse
Method Put()
Syntax Returns Type Description RestSharp.HttpResponse
Method Patch()
Syntax Returns Type Description RestSharp.HttpResponse
Method Merge()
Syntax Returns Type Description RestSharp.HttpResponse
Method AsPost(String)
Syntax Parameters Name Type Description httpMethod
string
Returns Type Description RestSharp.HttpResponse
Method AsGet(String)
Syntax Parameters Name Type Description httpMethod
string
Returns Type Description RestSharp.HttpResponse
Interface IHttpResponse
HTTP response data
Syntax Property ContentType
MIME content type of response
Syntax Property ContentLength
Length in bytes of the response content
Syntax Property ContentEncoding
Encoding of the response content
Syntax Property Content
String representation of response content
Syntax Property StatusCode
HTTP response status code
Syntax Property StatusDescription
Description of HTTP status returned
Syntax Property RawBytes
Response content
Syntax Property ResponseUri
The URL that actually responded to the content (different from request if redirected)
Syntax Property Server
HttpWebResponse.Server
Syntax Headers returned by server with the response
Syntax Property Cookies
Cookies returned by server with the response
Syntax Property ResponseStatus
Status of the request. Will return Error for transport errors.
HTTP errors will still return ResponseStatus.Completed, check StatusCode instead
Syntax Property ErrorMessage
Transport or other non-HTTP error generated while attempting request
Syntax Property ErrorException
Exception thrown when error is encountered.
Syntax Property ProtocolVersion
The HTTP protocol version (1.0, 1.1, etc)
Only set when underlying framework supports it.
Syntax Interface IRestClient
Syntax Extension methods RestSharp.RestClientExtensions.ExecuteAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse>)
RestSharp.RestClientExtensions.ExecuteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>>)
RestSharp.RestClientExtensions.GetAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PostAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PutAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.HeadAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.OptionsAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PatchAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.DeleteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.GetAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PostAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PutAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.HeadAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.OptionsAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PatchAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.DeleteAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.GetTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PostTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PutTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.HeadTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.OptionsTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PatchTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.DeleteTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.ExecuteDynamic(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.GetAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PostAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PutAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.HeadAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.OptionsAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PatchAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.DeleteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.Get<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Post<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Put<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Head<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Options<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Patch<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Delete<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Get(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Post(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Put(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Head(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Options(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Patch(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Delete(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, RestSharp.Parameter)
RestSharp.RestClientExtensions.AddOrUpdateDefaultParameter(RestSharp.IRestClient, RestSharp.Parameter)
RestSharp.RestClientExtensions.RemoveDefaultParameter(RestSharp.IRestClient, string)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, string, object)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, string, object, RestSharp.ParameterType)
RestSharp.RestClientExtensions.AddDefaultHeader(RestSharp.IRestClient, string, string)
RestSharp.RestClientExtensions.AddDefaultHeaders(RestSharp.IRestClient, System.Collections.Generic.Dictionary<string, string>)
RestSharp.RestClientExtensions.AddDefaultUrlSegment(RestSharp.IRestClient, string, string)
RestSharp.RestClientExtensions.AddDefaultQueryParameter(RestSharp.IRestClient, string, string)
RestSharp.RestClientJsonRequest.Get<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Post<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Put<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Head<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Options<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Patch<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Delete<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.Serialization.Xml.DotNetXmlSerializerClientExtensions.UseDotNetXmlSerializer(RestSharp.IRestClient, string, System.Text.Encoding)
Method UseSerializer(Func<IRestSerializer>)
The UseSerializer method.
Syntax Parameters Name Type Description serializerFactory
System.Func<RestSharp.Serialization.IRestSerializer>
The serializer factory
Returns Type Description RestSharp.IRestClient
Method UseSerializer<T>()
Replace the default serializer with a custom one
Syntax Generic parameters Name Description T
The type that implements IRestSerializer
Returns Type Description RestSharp.IRestClient
Property CookieContainer
Syntax Property AutomaticDecompression
Syntax Property MaxRedirects
Syntax Property UserAgent
Syntax Property Timeout
Syntax Property ReadWriteTimeout
Syntax Property UseSynchronizationContext
Syntax Property Authenticator
Syntax Property BaseUrl
Syntax Property Encoding
Syntax Property ThrowOnDeserializationError
Syntax Property FailOnDeserializationError
Modifies the default behavior of RestSharp to swallow exceptions.
When set to
true
, RestSharp will consider the request as unsuccessful
in case it fails to deserialize the response.
Syntax Property ThrowOnAnyError
Modifies the default behavior of RestSharp to swallow exceptions.
When set to
true
, exceptions will be re-thrown.
Syntax Property ConnectionGroupName
Syntax Property PreAuthenticate
Flag to send authorisation header with the HttpWebRequest
Syntax Property UnsafeAuthenticatedConnectionSharing
Flag to reuse same connection in the HttpWebRequest
Syntax Property DefaultParameters
A list of parameters that will be set for all requests made
by the RestClient instance.
Syntax Property BaseHost
Explicit Host header value to use in requests independent from the request URI.
If null, default host value extracted from URI is used.
Syntax Property AllowMultipleDefaultParametersWithSameName
By default, RestSharp doesn't allow multiple parameters to have the same name.
This properly allows to override the default behavior.
Syntax Property ClientCertificates
X509CertificateCollection to be sent with request
Syntax Property Proxy
Syntax Property CachePolicy
Syntax Property Pipelined
Syntax Property FollowRedirects
Syntax Property RemoteCertificateValidationCallback
Callback function for handling the validation of remote certificates. Useful for certificate pinning and
overriding certificate errors in the scope of a request.
Syntax Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Type Description RestSharp.IRestResponse<T>
Method UseUrlEncoder(Func<String, String>)
Allows to use a custom way to encode URL parameters
Examples Syntax Parameters Name Type Description encoder
System.Func<string, string>
A delegate to encode URL parameters
Returns Type Description RestSharp.IRestClient
Method UseQueryEncoder(Func<String, Encoding, String>)
Allows to use a custom way to encode query parameters
Examples Syntax Parameters Name Type Description queryEncoder
System.Func<string, System.Text.Encoding, string>
A delegate to encode query parameters
Returns Type Description RestSharp.IRestClient
Method Execute(IRestRequest)
Executes the given request and returns an untyped response.
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Pre-configured request instance.
Returns Type Description RestSharp.IRestResponse
Untyped response.
Method Execute(IRestRequest, Method)
Executes the given request and returns an untyped response.
Allows to specify the HTTP method (GET, POST, etc) so you won't need to set it on the request.
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Pre-configured request instance. httpMethod
RestSharp.Method
The HTTP method (GET, POST, etc) to be used when making the request.
Returns Type Description RestSharp.IRestResponse
Untyped response.
Method Execute<T>(IRestRequest)
Executes the given request and returns a typed response.
RestSharp will deserialize the response and it will be available in the
Data
property of the response instance.
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
Pre-configured request instance.
Returns Type Description RestSharp.IRestResponse<T>
Typed response.
Method Execute<T>(IRestRequest, Method)
Executes the given request and returns a typed response.
RestSharp will deserialize the response and it will be available in the
Data
property of the response instance.
Allows to specify the HTTP method (GET, POST, etc) so you won't need to set it on the request.
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
Pre-configured request instance. httpMethod
RestSharp.Method
The HTTP method (GET, POST, etc) to be used when making the request.
Returns Type Description RestSharp.IRestResponse<T>
Typed response.
Method DownloadData(IRestRequest)
A specialized method to download files.
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Pre-configured request instance.
Returns Type Description byte[]
The downloaded file.
Method DownloadData(IRestRequest, Boolean)
Executes the specified request and downloads the response data
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to execute throwOnError
bool
Throw an exception if download fails.
Returns Type Description byte[]
Response data
Method BuildUri(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Method BuildUriWithoutQueryParameters(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Add a delegate to apply custom configuration to HttpWebRequest before making a call
Syntax Parameters Name Type Description configurator
System.Action<HttpWebRequest>
Configuration delegate for HttpWebRequest
Method AddHandler(String, Func<IDeserializer>)
Adds or replaces a deserializer for the specified content type
Syntax Parameters Name Type Description contentType
string
Content type for which the deserializer will be replaced deserializerFactory
System.Func<RestSharp.Deserializers.IDeserializer>
Custom deserializer factory
Method RemoveHandler(String)
Removes custom deserialzier for the specified content type
Syntax Parameters Name Type Description contentType
string
Content type for which deserializer needs to be removed
Method ClearHandlers()
Remove deserializers for all content types
Syntax Method ExecuteAsGet(IRestRequest, String)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse
Method ExecuteAsPost(IRestRequest, String)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse
Method ExecuteAsGet<T>(IRestRequest, String)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse<T>
Method ExecuteAsPost<T>(IRestRequest, String)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse<T>
Method ExecuteAsync<T>(IRestRequest, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteAsync<T>(IRestRequest, Method, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteAsync(IRestRequest, Method, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteAsync(IRestRequest, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetAsync<T>(IRestRequest, CancellationToken)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostAsync<T>(IRestRequest, CancellationToken)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteGetAsync(IRestRequest, CancellationToken)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecutePostAsync(IRestRequest, CancellationToken)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method UseSerializer(IRestSerializer)
Syntax Parameters Name Type Description serializer
RestSharp.Serialization.IRestSerializer
Returns Type Description RestSharp.IRestClient
Method ExecuteAsync(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, Method)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
httpMethod
RestSharp.Method
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, Method)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
httpMethod
RestSharp.Method
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncGet(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, String)
Executes a GET-style request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle. httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncPost(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, String)
Executes a POST-style request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle. httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncGet<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, String)
Executes a GET-style request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncPost<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, String)
Executes a GET-style request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteTaskAsync<T>(IRestRequest)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync<T>(IRestRequest, CancellationToken)
Executes the request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync<T>(IRestRequest, Method)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteGetTaskAsync<T>(IRestRequest)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteGetTaskAsync<T>(IRestRequest, CancellationToken)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostTaskAsync<T>(IRestRequest)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostTaskAsync<T>(IRestRequest, CancellationToken)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync(IRestRequest, CancellationToken)
Executes the request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteTaskAsync(IRestRequest, CancellationToken, Method)
Executes the request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token httpMethod
RestSharp.Method
Override the request method
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteTaskAsync(IRestRequest)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetTaskAsync(IRestRequest)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetTaskAsync(IRestRequest, CancellationToken)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecutePostTaskAsync(IRestRequest)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecutePostTaskAsync(IRestRequest, CancellationToken)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method AddHandler(String, IDeserializer)
Adds or replaces a deserializer for the specified content type
Syntax Parameters Name Type Description contentType
string
Content type for which the deserializer will be replaced deserializer
RestSharp.Deserializers.IDeserializer
Custom deserializer
Interface IRestRequest
Syntax Always send a multipart/form-data request - even when no Files are present.
Syntax Property JsonSerializer
Serializer to use when writing JSON request bodies. Used if RequestFormat is Json.
By default the included JsonSerializer is used (currently using SimpleJson default serialization).
Syntax Property XmlSerializer
Serializer to use when writing XML request bodies. Used if RequestFormat is Xml.
By default the included XmlSerializer is used.
Syntax Property AdvancedResponseWriter
Set this to handle the response stream yourself, based on the response details
Syntax Property ResponseWriter
Set this to write response to Stream rather than reading into memory.
Syntax Property Parameters
Container of all HTTP parameters to be passed with the request.
See AddParameter() for explanation of the types of parameters that can be passed
Syntax Property Files
Container of all the files to be uploaded with the request.
Syntax Property Method
Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS
Default is GET
Syntax Property Resource
The Resource URL to make the request against.
Tokens are substituted with UrlSegment parameters and match by name.
Should not include the scheme or domain. Do not include leading slash.
Combined with RestClient.BaseUrl to assemble final URL:
{BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com)
Examples Syntax Serializer to use when writing request bodies.
Syntax Property RootElement
Used by the default deserializers to determine where to start deserializing from.
Can be used to skip container or root elements that do not have corresponding deserialzation targets.
Syntax Used by the default deserializers to explicitly set which date format string to use when parsing dates.
Syntax Property XmlNamespace
Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from
element names.
Syntax Property Credentials
In general you would not need to set this directly. Used by the NtlmAuthenticator.
Syntax Property Timeout
Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient.
Syntax Property ReadWriteTimeout
The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on
the RestClient.
Syntax Property Attempts
How many attempts were made to send this Request?
This number is incremented each time the RestClient sends the request.
Syntax Property UseDefaultCredentials
Determine whether or not the "default credentials" (e.g. the user account under which the current process is
running) will be sent along to the server. The default is false.
Syntax Property AllowedDecompressionMethods
List of allowed decompression methods
Syntax Property OnBeforeDeserialization
When supplied, the function will be called before calling the deserializer
Syntax Property OnBeforeRequest
When supplied, the function will be called before making a request
Syntax Property Body
Serialized request body to be accessed in authenticators
Syntax Method AddFile(String, String, String)
Adds a file to the Files collection to be included with a POST or PUT request
(other methods do not support file uploads).
Syntax Parameters Name Type Description name
string
The parameter name to use in the request path
string
Full path to file to upload contentType
string
The MIME type of the file to upload
Returns Type Description RestSharp.IRestRequest
This request
Method AddFile(String, Byte[], String, String)
Adds the bytes to the Files collection with the specified file name and content type
Syntax Parameters Name Type Description name
string
The parameter name to use in the request bytes
byte[]
The file data fileName
string
The file name to use for the uploaded file contentType
string
The MIME type of the file to upload
Returns Type Description RestSharp.IRestRequest
This request
Method AddFile(String, Action<Stream>, String, Int64, String)
Adds the bytes to the Files collection with the specified file name and content type
Syntax Parameters Name Type Description name
string
The parameter name to use in the request writer
System.Action<System.IO.Stream>
A function that writes directly to the stream. Should NOT close the stream. fileName
string
The file name to use for the uploaded file contentLength
long
The length (in bytes) of the file content. contentType
string
The MIME type of the file to upload
Returns Type Description RestSharp.IRestRequest
This request
Method AddFileBytes(String, Byte[], String, String)
Add bytes to the Files collection as if it was a file of specific type
Syntax Parameters Name Type Description name
string
A form parameter name bytes
byte[]
The file data filename
string
The file name to use for the uploaded file contentType
string
Specific content type. Es: application/x-gzip
Returns Type Description RestSharp.IRestRequest
Method AddBody(Object, String)
Serializes obj to format specified by RequestFormat, but passes XmlNamespace if using the default XmlSerializer
The default format is XML. Change RequestFormat if you wish to use a different serialization format.
Syntax Parameters Name Type Description obj
object
The object to serialize xmlNamespace
string
The XML namespace to use when serializing
Returns Type Description RestSharp.IRestRequest
This request
Method AddBody(Object)
Serializes obj to data format specified by RequestFormat and adds it to the request body.
The default format is XML. Change RequestFormat if you wish to use a different serialization format.
Syntax Parameters Name Type Description obj
object
The object to serialize
Returns Type Description RestSharp.IRestRequest
This request
Method AddJsonBody(Object)
Instructs RestSharp to send a given object in the request body, serialized as JSON.
Syntax Parameters Name Type Description obj
object
The object to serialize
Returns Type Description RestSharp.IRestRequest
This request
Method AddJsonBody(Object, String)
Instructs RestSharp to send a given object in the request body, serialized as JSON.
Allows specifying a custom content type. Usually, this method is used to support PATCH
requests that require application/json-patch+json content type.
Syntax Parameters Name Type Description obj
object
The object to serialize contentType
string
Custom content type to override the default application/json
Returns Type Description RestSharp.IRestRequest
This request
Method AddXmlBody(Object)
Instructs RestSharp to send a given object in the request body, serialized as XML.
Syntax Parameters Name Type Description obj
object
The object to serialize
Returns Type Description RestSharp.IRestRequest
This request
Method AddXmlBody(Object, String)
Instructs RestSharp to send a given object in the request body, serialized as XML
but passes XmlNamespace if using the default XmlSerializer.
Syntax Parameters Name Type Description obj
object
The object to serialize xmlNamespace
string
The XML namespace to use when serializing
Returns Type Description RestSharp.IRestRequest
This request
Method AddObject(Object, String[])
Calls AddParameter() for all public, readable properties specified in the includedProperties list
Examples Syntax Parameters Name Type Description obj
object
The object with properties to add as parameters includedProperties
string[]
The names of the properties to include
Returns Type Description RestSharp.IRestRequest
This request
Method AddObject(Object)
Calls AddParameter() for all public, readable properties of obj
Syntax Parameters Name Type Description obj
object
The object with properties to add as parameters
Returns Type Description RestSharp.IRestRequest
This request
Method AddParameter(Parameter)
Add the parameter to the request
Syntax Parameters Name Type Description p
RestSharp.Parameter
Parameter to add
Returns Type Description RestSharp.IRestRequest
Method AddParameter(String, Object)
Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT)
Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter
Returns Type Description RestSharp.IRestRequest
This request
Method AddParameter(String, Object, ParameterType)
Adds a parameter to the request. There are five types of parameters:
GetOrPost: Either a QueryString value or encoded form value based on method HttpHeader: Adds the name/value pair to the HTTP request's Headers collection UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} Cookie: Adds the name/value pair to the HTTP request's Cookies collection RequestBody: Used by AddBody() (not recommended to use directly) Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter type
RestSharp.ParameterType
The type of parameter to add
Returns Type Description RestSharp.IRestRequest
This request
Method AddParameter(String, Object, String, ParameterType)
Adds a parameter to the request. There are five types of parameters:
GetOrPost: Either a QueryString value or encoded form value based on method HttpHeader: Adds the name/value pair to the HTTP request's Headers collection UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} Cookie: Adds the name/value pair to the HTTP request's Cookies collection RequestBody: Used by AddBody() (not recommended to use directly) Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter contentType
string
Content-Type of the parameter type
RestSharp.ParameterType
The type of parameter to add
Returns Type Description RestSharp.IRestRequest
This request
Method AddOrUpdateParameter(Parameter)
Adds a parameter to the request or updates it with the given argument, if the parameter already exists in the
request.
Syntax Parameters Name Type Description parameter
RestSharp.Parameter
Parameter to add
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameters(IEnumerable<Parameter>)
Add or update parameters to the request
Syntax Parameters Name Type Description parameters
System.Collections.Generic.IEnumerable<RestSharp.Parameter>
Collection of parameters to add
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameter(String, Object)
Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT)
Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter
Returns Type Description RestSharp.IRestRequest
This request
Method AddOrUpdateParameter(String, Object, ParameterType)
Adds a parameter to the request. There are five types of parameters:
GetOrPost: Either a QueryString value or encoded form value based on method HttpHeader: Adds the name/value pair to the HTTP request Headers collection UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} Cookie: Adds the name/value pair to the HTTP request Cookies collection RequestBody: Used by AddBody() (not recommended to use directly) Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter type
RestSharp.ParameterType
The type of parameter to add
Returns Type Description RestSharp.IRestRequest
This request
Method AddOrUpdateParameter(String, Object, String, ParameterType)
Adds a parameter to the request. There are five types of parameters:
GetOrPost: Either a QueryString value or encoded form value based on method HttpHeader: Adds the name/value pair to the HTTP request Headers collection UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} Cookie: Adds the name/value pair to the HTTP request Cookies collection RequestBody: Used by AddBody() (not recommended to use directly) Syntax Parameters Name Type Description name
string
Name of the parameter value
object
Value of the parameter contentType
string
Content-Type of the parameter type
RestSharp.ParameterType
The type of parameter to add
Returns Type Description RestSharp.IRestRequest
This request
Shortcut to AddParameter(name, value, HttpHeader) overload
Syntax Parameters Name Type Description name
string
Name of the header to add value
string
Value of the header to add
Returns Type Description RestSharp.IRestRequest
Uses AddHeader(name, value) in a convenient way to pass
in multiple headers at once.
Syntax Parameters Name Type Description headers
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>
Key/Value pairs containing the name: value of the headers
Returns Type Description RestSharp.IRestRequest
This request
Method AddCookie(String, String)
Shortcut to AddParameter(name, value, Cookie) overload
Syntax Parameters Name Type Description name
string
Name of the cookie to add value
string
Value of the cookie to add
Returns Type Description RestSharp.IRestRequest
Method AddUrlSegment(String, String)
Shortcut to AddParameter(name, value, UrlSegment) overload
Syntax Parameters Name Type Description name
string
Name of the segment to add value
string
Value of the segment to add
Returns Type Description RestSharp.IRestRequest
Method AddUrlSegment(String, Object)
Shortcut to AddParameter(name, value, UrlSegment) overload
Syntax Parameters Name Type Description name
string
Name of the segment to add value
object
Value of the segment to add
Returns Type Description RestSharp.IRestRequest
Method AddQueryParameter(String, String)
Shortcut to AddParameter(name, value, QueryString) overload
Syntax Parameters Name Type Description name
string
Name of the parameter to add value
string
Value of the parameter to add
Returns Type Description RestSharp.IRestRequest
Method AddQueryParameter(String, String, Boolean)
Shortcut to AddParameter(name, value, QueryString) overload
Syntax Parameters Name Type Description name
string
Name of the parameter to add value
string
Value of the parameter to add encode
bool
Whether parameter should be encoded or not
Returns Type Description RestSharp.IRestRequest
Method AddDecompressionMethod(DecompressionMethods)
Syntax Parameters Name Type Description decompressionMethod
DecompressionMethods
Returns Type Description RestSharp.IRestRequest
Method IncreaseNumAttempts()
Syntax Interface IRestResponse
Container for data sent back from API
Syntax Extension methods RestSharp.Extensions.ResponseExtensions.ToAsyncResponse<T>(RestSharp.IRestResponse)
Property Request
The RestRequest that was made to get this RestResponse
Mainly for debugging if ResponseStatus is not OK
Syntax Property ContentType
MIME content type of response
Syntax Property ContentLength
Length in bytes of the response content
Syntax Property ContentEncoding
Encoding of the response content
Syntax Property Content
String representation of response content
Syntax Property StatusCode
HTTP response status code
Syntax Property IsSuccessful
Whether or not the response status code indicates success
Syntax Property StatusDescription
Description of HTTP status returned
Syntax Property RawBytes
Response content
Syntax Property ResponseUri
The URL that actually responded to the content (different from request if redirected)
Syntax Property Server
HttpWebResponse.Server
Syntax Property Cookies
Cookies returned by server with the response
Syntax Headers returned by server with the response
Syntax Property ResponseStatus
Status of the request. Will return Error for transport errors.
HTTP errors will still return ResponseStatus.Completed, check StatusCode instead
Syntax Property ErrorMessage
Transport or other non-HTTP error generated while attempting request
Syntax Property ErrorException
Exceptions thrown during the request, if any.
Will contain only network transport or framework exceptions thrown during the request.
HTTP protocol errors are handled by RestSharp and will not appear here.
Syntax Property ProtocolVersion
The HTTP protocol version (1.0, 1.1, etc)
Only set when underlying framework supports it.
Syntax Interface IRestResponse<T>
Container for data sent back from API including deserialized data
Syntax Generic parameters Name Description T
Type of data to deserialize to
Extension methods RestSharp.Extensions.ResponseExtensions.ToAsyncResponse<T>(RestSharp.IRestResponse)
Property Data
Deserialized entity data
Syntax Class JsonRequest<TRequest, TResponse>
Inheritance ↳ object
↳ RestSharp.RestRequest
Syntax Generic parameters Name Description TRequest
TResponse
Constructor JsonRequest(String, TRequest)
Syntax Parameters Name Type Description resource
string
request
TRequest
Method ResponseForStatusCode(HttpStatusCode, TResponse)
Syntax Parameters Name Type Description statusCode
HttpStatusCode
response
TResponse
Returns Type Description RestSharp.JsonRequest<TRequest, TResponse>
Method ResponseForStatusCode(HttpStatusCode, Func<TResponse>)
Syntax Parameters Name Type Description statusCode
HttpStatusCode
getResponse
System.Func<TResponse>
Returns Type Description RestSharp.JsonRequest<TRequest, TResponse>
Method ChangeResponse(Action<IRestResponse<TResponse>>)
Syntax Parameters Name Type Description change
System.Action<RestSharp.IRestResponse<TResponse>>
Returns Type Description RestSharp.JsonRequest<TRequest, TResponse>
Class RestClient
Client to translate RestRequests into Http requests and process response result
Inheritance ↳ object
Syntax Extension methods RestSharp.RestClientExtensions.ExecuteAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse>)
RestSharp.RestClientExtensions.ExecuteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>>)
RestSharp.RestClientExtensions.GetAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PostAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PutAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.HeadAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.OptionsAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PatchAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.DeleteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.GetAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PostAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PutAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.HeadAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.OptionsAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.PatchAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.DeleteAsync(RestSharp.IRestClient, RestSharp.IRestRequest, System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>)
RestSharp.RestClientExtensions.GetTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PostTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PutTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.HeadTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.OptionsTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.PatchTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.DeleteTaskAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.ExecuteDynamic(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.GetAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PostAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PutAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.HeadAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.OptionsAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.PatchAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.DeleteAsync<T>(RestSharp.IRestClient, RestSharp.IRestRequest, System.Threading.CancellationToken)
RestSharp.RestClientExtensions.Get<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Post<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Put<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Head<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Options<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Patch<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Delete<T>(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Get(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Post(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Put(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Head(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Options(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Patch(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.Delete(RestSharp.IRestClient, RestSharp.IRestRequest)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, RestSharp.Parameter)
RestSharp.RestClientExtensions.AddOrUpdateDefaultParameter(RestSharp.IRestClient, RestSharp.Parameter)
RestSharp.RestClientExtensions.RemoveDefaultParameter(RestSharp.IRestClient, string)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, string, object)
RestSharp.RestClientExtensions.AddDefaultParameter(RestSharp.IRestClient, string, object, RestSharp.ParameterType)
RestSharp.RestClientExtensions.AddDefaultHeader(RestSharp.IRestClient, string, string)
RestSharp.RestClientExtensions.AddDefaultHeaders(RestSharp.IRestClient, System.Collections.Generic.Dictionary<string, string>)
RestSharp.RestClientExtensions.AddDefaultUrlSegment(RestSharp.IRestClient, string, string)
RestSharp.RestClientExtensions.AddDefaultQueryParameter(RestSharp.IRestClient, string, string)
RestSharp.RestClientExtensions.UseJson(RestSharp.RestClient)
RestSharp.RestClientExtensions.UseXml(RestSharp.RestClient)
RestSharp.RestClientJsonRequest.Get<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Post<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Put<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Head<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Options<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Patch<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.RestClientJsonRequest.Delete<TRequest, TResponse>(RestSharp.IRestClient, RestSharp.JsonRequest<TRequest, TResponse>)
RestSharp.Serialization.Xml.DotNetXmlSerializerClientExtensions.UseDotNetXmlSerializer(RestSharp.IRestClient, string, System.Text.Encoding)
Method ExecuteTaskAsync(IRestRequest, CancellationToken, Method)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token httpMethod
RestSharp.Method
Override the request method
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteAsync(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, Method)
Executes the request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle. httpMethod
RestSharp.Method
HTTP call method (GET, PUT, etc)
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Executes the request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle.
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncGet(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, String)
Executes a GET-style request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle. httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncPost(IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>, String)
Executes a POST-style request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion providing access to the async handle. httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, Method)
Executes the request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion httpMethod
RestSharp.Method
Override the request http method
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Executes the request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncGet<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, String)
Executes a GET-style request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsyncPost<T>(IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>, String)
Executes a POST-style request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Callback function to be executed upon completion httpMethod
string
The HTTP method to execute
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteGetTaskAsync<T>(IRestRequest)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync(IRestRequest, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteTaskAsync<T>(IRestRequest, CancellationToken, Method)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token httpMethod
RestSharp.Method
Override the request method
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteGetTaskAsync<T>(IRestRequest, CancellationToken)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostTaskAsync<T>(IRestRequest, CancellationToken)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostTaskAsync<T>(IRestRequest)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync<T>(IRestRequest, Method)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync<T>(IRestRequest)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteTaskAsync<T>(IRestRequest, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostTaskAsync(IRestRequest, CancellationToken)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecutePostTaskAsync(IRestRequest)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteTaskAsync(IRestRequest)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetTaskAsync(IRestRequest)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetTaskAsync(IRestRequest, CancellationToken)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed token
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteGetAsync<T>(IRestRequest, CancellationToken)
Executes a GET-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecutePostAsync<T>(IRestRequest, CancellationToken)
Executes a POST-style request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
The cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteGetAsync(IRestRequest, CancellationToken)
Executes a GET-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecutePostAsync(IRestRequest, CancellationToken)
Executes a POST-style asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteAsync<T>(IRestRequest, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteAsync(IRestRequest, Method, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Method ExecuteAsync<T>(IRestRequest, Method, CancellationToken)
Executes the request asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description request
RestSharp.IRestRequest
Request to be executed httpMethod
RestSharp.Method
Override the request method cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse<T>>
Method ExecuteAsync(IRestRequest, CancellationToken)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
token
System.Threading.CancellationToken
Returns Type Description System.Threading.Tasks.Task<RestSharp.IRestResponse>
Constructor RestClient()
Default constructor that registers default content handlers
Syntax Constructor RestClient(Uri)
Sets the BaseUrl property for requests made by this client instance
Syntax Parameters Name Type Description baseUrl
Uri
Constructor RestClient(String)
Sets the BaseUrl property for requests made by this client instance
Syntax Parameters Name Type Description baseUrl
string
Method UseSerializer(IRestSerializer)
Syntax Parameters Name Type Description serializer
RestSharp.Serialization.IRestSerializer
Returns Type Description RestSharp.IRestClient
Method UseUrlEncoder(Func<String, String>)
Syntax Parameters Name Type Description encoder
System.Func<string, string>
Returns Type Description RestSharp.IRestClient
Method UseQueryEncoder(Func<String, Encoding, String>)
Syntax Parameters Name Type Description queryEncoder
System.Func<string, System.Text.Encoding, string>
Returns Type Description RestSharp.IRestClient
Property AutomaticDecompression
Syntax Property MaxRedirects
Syntax Property ClientCertificates
Syntax Property Proxy
Syntax Property CachePolicy
Syntax Property Pipelined
Syntax Property FollowRedirects
Syntax Property CookieContainer
Syntax Property UserAgent
Syntax Property Timeout
Syntax Property ReadWriteTimeout
Syntax Property UseSynchronizationContext
Syntax Property Authenticator
Syntax Property BaseUrl
Syntax Property Encoding
Syntax Property PreAuthenticate
Syntax Property ThrowOnDeserializationError
Syntax Property FailOnDeserializationError
Syntax Property ThrowOnAnyError
Syntax Property UnsafeAuthenticatedConnectionSharing
Syntax Property ConnectionGroupName
Syntax Property RemoteCertificateValidationCallback
Syntax Property DefaultParameters
Syntax Property BaseHost
Syntax Property AllowMultipleDefaultParametersWithSameName
Syntax Method AddHandler(String, Func<IDeserializer>)
Syntax Parameters Name Type Description contentType
string
deserializerFactory
System.Func<RestSharp.Deserializers.IDeserializer>
Method AddHandler(String, IDeserializer)
Syntax Parameters Name Type Description contentType
string
deserializer
RestSharp.Deserializers.IDeserializer
Method RemoveHandler(String)
Syntax Parameters Name Type Description contentType
string
Method ClearHandlers()
Syntax Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Type Description RestSharp.IRestResponse<T>
Syntax Parameters Name Type Description configurator
System.Action<HttpWebRequest>
Method BuildUri(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Method IRestClient.BuildUriWithoutQueryParameters(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Method UseSerializer(Func<IRestSerializer>)
Syntax Parameters Name Type Description serializerFactory
System.Func<RestSharp.Serialization.IRestSerializer>
Returns Type Description RestSharp.IRestClient
Method UseSerializer<T>()
Syntax Generic parameters Returns Type Description RestSharp.IRestClient
Method DownloadData(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Method DownloadData(IRestRequest, Boolean)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
throwOnError
bool
Returns Method Execute(IRestRequest, Method)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
RestSharp.Method
Returns Type Description RestSharp.IRestResponse
Method Execute(IRestRequest)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
Returns Type Description RestSharp.IRestResponse
Method ExecuteAsGet(IRestRequest, String)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse
Method ExecuteAsPost(IRestRequest, String)
Syntax Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse
Method Execute<T>(IRestRequest, Method)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
RestSharp.Method
Returns Type Description RestSharp.IRestResponse<T>
Method Execute<T>(IRestRequest)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
Returns Type Description RestSharp.IRestResponse<T>
Method ExecuteAsGet<T>(IRestRequest, String)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse<T>
Method ExecuteAsPost<T>(IRestRequest, String)
Syntax Generic parameters Parameters Name Type Description request
RestSharp.IRestRequest
httpMethod
string
Returns Type Description RestSharp.IRestResponse<T>
Class RestClientExtensions
Inheritance ↳ object
Syntax Method ExecuteAsync(IRestClient, IRestRequest, Action<IRestResponse>)
Executes the request and callback asynchronously, authenticating if needed
Syntax Parameters Name Type Description client
RestSharp.IRestClient
The IRestClient this method extends request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse>
Callback function to be executed upon completion
Returns Type Description RestSharp.RestRequestAsyncHandle
Method ExecuteAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>>)
Executes the request and callback asynchronously, authenticating if needed
Syntax Generic parameters Name Description T
Target deserialization type
Parameters Name Type Description client
RestSharp.IRestClient
The IRestClient this method extends request
RestSharp.IRestRequest
Request to be executed callback
System.Action<RestSharp.IRestResponse<T>>
Callback function to be executed upon completion providing access to the async handle
Returns Type Description RestSharp.RestRequestAsyncHandle
Method GetAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PostAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PutAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method HeadAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method OptionsAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PatchAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method DeleteAsync<T>(IRestClient, IRestRequest, Action<IRestResponse<T>, RestRequestAsyncHandle>)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse<T>, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method GetAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PostAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PutAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method HeadAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method OptionsAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method PatchAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method DeleteAsync(IRestClient, IRestRequest, Action<IRestResponse, RestRequestAsyncHandle>)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
callback
System.Action<RestSharp.IRestResponse, RestSharp.RestRequestAsyncHandle>
Returns Type Description RestSharp.RestRequestAsyncHandle
Method GetTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method PostTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method PutTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method HeadTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method OptionsTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method PatchTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method DeleteTaskAsync<T>(IRestClient, IRestRequest)
Syntax Generic parameters Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Returns Type Description System.Threading.Tasks.Task<T>
Method ExecuteDynamic(IRestClient, IRestRequest)
Execute the request and returns a response with the dynamic object as Data
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<dynamic>
Method GetAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using GET HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method PostAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using POST HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method PutAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using PUT HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method HeadAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using HEAD HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method OptionsAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using OPTIONS HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method PatchAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using PATCH HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method DeleteAsync<T>(IRestClient, IRestRequest, CancellationToken)
Execute the request using DELETE HTTP method. Exception will be thrown if the request does not succeed.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request cancellationToken
System.Threading.CancellationToken
Cancellation token
Returns Type Description System.Threading.Tasks.Task<T>
Method Get<T>(IRestClient, IRestRequest)
Execute the request using GET HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Post<T>(IRestClient, IRestRequest)
Execute the request using POST HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Put<T>(IRestClient, IRestRequest)
Execute the request using PUT HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Head<T>(IRestClient, IRestRequest)
Execute the request using HEAD HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Options<T>(IRestClient, IRestRequest)
Execute the request using OPTIONS HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Patch<T>(IRestClient, IRestRequest)
Execute the request using PATCH HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Delete<T>(IRestClient, IRestRequest)
Execute the request using DELETE HTTP method.
The response data is deserialized to the Data property of the returned response object.
Syntax Generic parameters Name Description T
Expected result type
Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse<T>
Method Get(IRestClient, IRestRequest)
Execute the request using GET HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Post(IRestClient, IRestRequest)
Execute the request using POST HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Put(IRestClient, IRestRequest)
Execute the request using PUT HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Head(IRestClient, IRestRequest)
Execute the request using HEAD HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Options(IRestClient, IRestRequest)
Execute the request using OPTIONS HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Patch(IRestClient, IRestRequest)
Execute the request using PATCH HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method Delete(IRestClient, IRestRequest)
Execute the request using DELETE HTTP method.
Syntax Parameters Name Type Description client
RestSharp.IRestClient
RestClient instance request
RestSharp.IRestRequest
The request
Returns Type Description RestSharp.IRestResponse
Method AddDefaultParameter(IRestClient, Parameter)
Add a parameter to use on every request made with this client instance
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance p
RestSharp.Parameter
Parameter to add
Returns Type Description RestSharp.IRestClient
Method AddOrUpdateDefaultParameter(IRestClient, Parameter)
Add a new or update an existing parameter to use on every request made with this client instance
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
p
RestSharp.Parameter
Returns Type Description RestSharp.IRestClient
Method RemoveDefaultParameter(IRestClient, String)
Removes a parameter from the default parameters that are used on every request made with this client instance
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
The name of the parameter that needs to be removed
Returns Type Description RestSharp.IRestClient
Method AddDefaultParameter(IRestClient, String, Object)
Adds a default HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT)
Used on every request made by this client instance
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
Name of the parameter value
object
Value of the parameter
Returns Type Description RestSharp.IRestClient
This request
Method AddDefaultParameter(IRestClient, String, Object, ParameterType)
Adds a default parameter to the request. There are four types of parameters:
GetOrPost: Either a QueryString value or encoded form value based on method HttpHeader: Adds the name/value pair to the HTTP request's Headers collection UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} RequestBody: Used by AddBody() (not recommended to use directly)
Used on every request made by this client instance Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
Name of the parameter value
object
Value of the parameter type
RestSharp.ParameterType
The type of parameter to add
Returns Type Description RestSharp.IRestClient
This request
Adds a default header to the RestClient. Used on every request made by this client instance.
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
Name of the header to add value
string
Value of the header to add
Returns Type Description RestSharp.IRestClient
Adds default headers to the RestClient. Used on every request made by this client instance.
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance headers
System.Collections.Generic.Dictionary<string, string>
Dictionary containing the Names and Values of the headers to add
Returns Type Description RestSharp.IRestClient
Method AddDefaultUrlSegment(IRestClient, String, String)
Adds a default URL segment parameter to the RestClient. Used on every request made by this client instance.
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
Name of the segment to add value
string
Value of the segment to add
Returns Type Description RestSharp.IRestClient
Method AddDefaultQueryParameter(IRestClient, String, String)
Adds a default URL query parameter to the RestClient. Used on every request made by this client instance.
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
The IRestClient instance name
string
Name of the query parameter to add value
string
Value of the query parameter to add
Returns Type Description RestSharp.IRestClient
Method UseJson(RestClient)
Syntax Parameters Name Type Description client
RestSharp.RestClient
Returns Type Description RestSharp.RestClient
Method UseXml(RestClient)
Syntax Parameters Name Type Description client
RestSharp.RestClient
Returns Type Description RestSharp.RestClient
Class NameValuePair
Inheritance ↳ object
Syntax Field Empty
Syntax Constructor NameValuePair(String, String)
Syntax Parameters Name Type Description name
string
value
string
Property Name
Syntax Property Value
Syntax Property IsEmpty
Syntax Class Parameter
Parameter container for REST requests
Inheritance ↳ object
Syntax Constructor Parameter(String, Object, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
type
RestSharp.ParameterType
Constructor Parameter(String, Object, String, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
contentType
string
type
RestSharp.ParameterType
Property Name
Name of the parameter
Syntax Property Value
Value of the parameter
Syntax Property Type
Type of the parameter
Syntax Body parameter data type
Syntax Property ContentType
MIME content type of the parameter
Syntax Method ToString()
Return a human-readable representation of this parameter
Syntax Returns Type Description string
String
Method Equals(Parameter)
Syntax Parameters Name Type Description other
RestSharp.Parameter
Returns Method Equals(Object)
Syntax Parameters Name Type Description obj
object
Returns Method GetHashCode()
Syntax Returns Class XmlParameter
Inheritance ↳ object
↳ RestSharp.Parameter
Syntax Constructor XmlParameter(String, Object, String)
Syntax Parameters Name Type Description name
string
value
object
xmlNamespace
string
Property XmlNamespace
Syntax Class JsonParameter
Inheritance ↳ object
↳ RestSharp.Parameter
Inherited members Syntax Constructor JsonParameter(String, Object)
Syntax Parameters Name Type Description name
string
value
object
Constructor JsonParameter(String, Object, String)
Syntax Parameters Name Type Description name
string
value
object
contentType
string
Class RequestBody
Inheritance ↳ object
Syntax Property ContentType
Syntax Property Name
Syntax Property Value
Syntax Constructor RequestBody(String, String, Object)
Syntax Parameters Name Type Description contentType
string
name
string
value
object
Class RestClientJsonRequest
Inheritance ↳ object
Syntax Method Get<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Post<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Put<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Head<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Options<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Patch<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Method Delete<TRequest, TResponse>(IRestClient, JsonRequest<TRequest, TResponse>)
Syntax Generic parameters Name Description TRequest
TResponse
Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.JsonRequest<TRequest, TResponse>
Returns Type Description RestSharp.IRestResponse<TResponse>
Class RestRequest
Container for data used to make requests
Inheritance ↳ object
Syntax Constructor RestRequest()
Default constructor
Syntax Constructor RestRequest(Method)
Sets Method property to value of method
Syntax Parameters Name Type Description method
RestSharp.Method
Method to use for this request
Constructor RestRequest(String, Method)
Syntax Parameters Name Type Description resource
string
method
RestSharp.Method
Syntax Parameters Name Type Description resource
string
dataFormat
RestSharp.DataFormat
Constructor RestRequest(String)
Syntax Parameters Name Type Description resource
string
Syntax Parameters Name Type Description resource
string
method
RestSharp.Method
dataFormat
RestSharp.DataFormat
Syntax Parameters Name Type Description resource
Uri
method
RestSharp.Method
dataFormat
RestSharp.DataFormat
Constructor RestRequest(Uri, Method)
Syntax Parameters Name Type Description resource
Uri
method
RestSharp.Method
Constructor RestRequest(Uri)
Syntax Parameters Name Type Description resource
Uri
Property AllowedDecompressionMethods
Syntax Syntax Property JsonSerializer
Syntax Property XmlSerializer
Syntax Property Body
Syntax Property ResponseWriter
Syntax Property AdvancedResponseWriter
Syntax Property UseDefaultCredentials
Syntax Method AddFile(String, String, String)
Syntax Parameters Name Type Description name
string
path
string
contentType
string
Returns Type Description RestSharp.IRestRequest
Method AddFile(String, Byte[], String, String)
Syntax Parameters Name Type Description name
string
bytes
byte[]
fileName
string
contentType
string
Returns Type Description RestSharp.IRestRequest
Method AddFile(String, Action<Stream>, String, Int64, String)
Syntax Parameters Name Type Description name
string
writer
System.Action<System.IO.Stream>
fileName
string
contentLength
long
contentType
string
Returns Type Description RestSharp.IRestRequest
Method AddFileBytes(String, Byte[], String, String)
Syntax Parameters Name Type Description name
string
bytes
byte[]
filename
string
contentType
string
Returns Type Description RestSharp.IRestRequest
Method AddBody(Object, String)
Syntax Parameters Name Type Description obj
object
xmlNamespace
string
Returns Type Description RestSharp.IRestRequest
Method AddBody(Object)
Syntax Parameters Name Type Description obj
object
Returns Type Description RestSharp.IRestRequest
Method AddJsonBody(Object)
Syntax Parameters Name Type Description obj
object
Returns Type Description RestSharp.IRestRequest
Method AddJsonBody(Object, String)
Syntax Parameters Name Type Description obj
object
contentType
string
Returns Type Description RestSharp.IRestRequest
Method AddXmlBody(Object)
Syntax Parameters Name Type Description obj
object
Returns Type Description RestSharp.IRestRequest
Method AddXmlBody(Object, String)
Syntax Parameters Name Type Description obj
object
xmlNamespace
string
Returns Type Description RestSharp.IRestRequest
Method AddObject(Object, String[])
Syntax Parameters Name Type Description obj
object
includedProperties
string[]
Returns Type Description RestSharp.IRestRequest
Method AddObject(Object)
Syntax Parameters Name Type Description obj
object
Returns Type Description RestSharp.IRestRequest
Method AddParameter(Parameter)
Syntax Parameters Name Type Description p
RestSharp.Parameter
Returns Type Description RestSharp.IRestRequest
Method AddParameter(String, Object)
Syntax Parameters Name Type Description name
string
value
object
Returns Type Description RestSharp.IRestRequest
Method AddParameter(String, Object, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
type
RestSharp.ParameterType
Returns Type Description RestSharp.IRestRequest
Method AddParameter(String, Object, String, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
contentType
string
type
RestSharp.ParameterType
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameter(Parameter)
Syntax Parameters Name Type Description parameter
RestSharp.Parameter
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameters(IEnumerable<Parameter>)
Syntax Parameters Name Type Description parameters
System.Collections.Generic.IEnumerable<RestSharp.Parameter>
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameter(String, Object)
Syntax Parameters Name Type Description name
string
value
object
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameter(String, Object, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
type
RestSharp.ParameterType
Returns Type Description RestSharp.IRestRequest
Method AddOrUpdateParameter(String, Object, String, ParameterType)
Syntax Parameters Name Type Description name
string
value
object
contentType
string
type
RestSharp.ParameterType
Returns Type Description RestSharp.IRestRequest
Syntax Parameters Name Type Description name
string
value
string
Returns Type Description RestSharp.IRestRequest
Syntax Parameters Name Type Description headers
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>
Returns Type Description RestSharp.IRestRequest
Method AddCookie(String, String)
Syntax Parameters Name Type Description name
string
value
string
Returns Type Description RestSharp.IRestRequest
Method AddUrlSegment(String, String)
Syntax Parameters Name Type Description name
string
value
string
Returns Type Description RestSharp.IRestRequest
Method AddQueryParameter(String, String)
Syntax Parameters Name Type Description name
string
value
string
Returns Type Description RestSharp.IRestRequest
Method AddQueryParameter(String, String, Boolean)
Syntax Parameters Name Type Description name
string
value
string
encode
bool
Returns Type Description RestSharp.IRestRequest
Method AddDecompressionMethod(DecompressionMethods)
Syntax Parameters Name Type Description decompressionMethod
DecompressionMethods
Returns Type Description RestSharp.IRestRequest
Property Parameters
Syntax Property Files
Syntax Property Method
Syntax Property Resource
Syntax Syntax Property RootElement
Syntax Property OnBeforeDeserialization
Syntax Property OnBeforeRequest
Syntax Syntax Property XmlNamespace
Syntax Property Credentials
Syntax Property Timeout
Syntax Property ReadWriteTimeout
Syntax Method IncreaseNumAttempts()
Syntax Property Attempts
Syntax Method AddUrlSegment(String, Object)
Syntax Parameters Name Type Description name
string
value
object
Returns Type Description RestSharp.IRestRequest
Class RestRequestAsyncHandle
Inheritance ↳ object
Syntax Field WebRequest
Syntax Method Abort()
Syntax Class RestResponseBase
Base class for common properties shared by RestResponse and RestResponse[[T]]
Inheritance ↳ object
Syntax Constructor RestResponseBase()
Default constructor
Syntax Property Request
The RestRequest that was made to get this RestResponse
Mainly for debugging if ResponseStatus is not OK
Syntax Property ContentType
MIME content type of response
Syntax Property ContentLength
Length in bytes of the response content
Syntax Property ContentEncoding
Encoding of the response content
Syntax Property Content
String representation of response content
Syntax Property StatusCode
HTTP response status code
Syntax Property IsSuccessful
Whether or not the response status code indicates success
Syntax Property StatusDescription
Description of HTTP status returned
Syntax Property RawBytes
Response content
Syntax Property ResponseUri
The URL that actually responded to the content (different from request if redirected)
Syntax Property Server
HttpWebResponse.Server
Syntax Property Cookies
Cookies returned by server with the response
Syntax Headers returned by server with the response
Syntax Property ResponseStatus
Status of the request. Will return Error for transport errors.
HTTP errors will still return ResponseStatus.Completed, check StatusCode instead
Syntax Property ErrorMessage
Transport or other non-HTTP error generated while attempting request
Syntax Property ErrorException
The exception thrown during the request, if any
Syntax Property ProtocolVersion
The HTTP protocol version (1.0, 1.1, etc)
Only set when underlying framework supports it.
Syntax Method DebuggerDisplay()
Assists with debugging responses by displaying in the debugger output
Syntax Returns Class RestResponse<T>
Container for data sent back from API including deserialized data
Inheritance ↳ object
↳ RestSharp.RestResponseBase
Syntax Generic parameters Name Description T
Type of data to deserialize to
Extension methods RestSharp.Extensions.ResponseExtensions.ToAsyncResponse<T>(RestSharp.IRestResponse)
Property Data
Deserialized entity data
Syntax Operator: RestSharp.RestResponse1.op_Explicit(RestSharp.RestResponse)~RestSharp.RestResponse{
0}
Class RestResponse
Container for data sent back from API
Inheritance ↳ object
↳ RestSharp.RestResponseBase
Inherited members RestSharp.RestResponseBase.Request
Syntax Extension methods RestSharp.Extensions.ResponseExtensions.ToAsyncResponse<T>(RestSharp.IRestResponse)
Class RestResponseCookie
Inheritance ↳ object
Syntax Comment of the cookie
Syntax Comment of the cookie
Syntax Property Discard
Indicates whether the cookie should be discarded at the end of the session
Syntax Property Domain
Domain of the cookie
Syntax Property Expired
Indicates whether the cookie is expired
Syntax Property Expires
Date and time that the cookie expires
Syntax Property HttpOnly
Indicates that this cookie should only be accessed by the server
Syntax Property Name
Name of the cookie
Syntax Property Path
Path of the cookie
Syntax Property Port
Port of the cookie
Syntax Property Secure
Indicates that the cookie should only be sent over secure channels
Syntax Property TimeStamp
Date and time the cookie was created
Syntax Property Value
Value of the cookie
Syntax Property Version
Version of the cookie
Syntax Property HttpCookie
Syntax Namespace: RestSharp.Authenticators Class AuthenticatorBase
Inheritance ↳ object
Syntax Constructor AuthenticatorBase(String)
Syntax Parameters Name Type Description token
string
Property Token
Syntax Method GetAuthenticationParameter(String)
Syntax Parameters Name Type Description accessToken
string
Returns Type Description RestSharp.Parameter
Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Class HttpBasicAuthenticator
Allows "basic access authentication" for HTTP requests.
Encoding can be specified depending on what your server expect (see https://stackoverflow.com/a/7243567).
UTF-8 is used by default but some servers might expect ISO-8859-1 encoding.
Inheritance ↳ object
↳ RestSharp.Authenticators.AuthenticatorBase
Syntax Constructor HttpBasicAuthenticator(String, String)
Syntax Parameters Name Type Description username
string
password
string
Constructor HttpBasicAuthenticator(String, String, Encoding)
Syntax Parameters Name Type Description username
string
password
string
encoding
System.Text.Encoding
Method GetAuthenticationParameter(String)
Syntax Parameters Name Type Description accessToken
string
Returns Type Description RestSharp.Parameter
Interface IAuthenticator
Syntax Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Class JwtAuthenticator
JSON WEB TOKEN (JWT) Authenticator class.
https://tools.ietf.org/html/draft-ietf-oauth-json-web-token
Inheritance ↳ object
Syntax Constructor JwtAuthenticator(String)
Syntax Parameters Name Type Description accessToken
string
Method SetBearerToken(String)
Set the new bearer token so the request gets the new header value
Syntax Parameters Name Type Description accessToken
string
Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Class NtlmAuthenticator
Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user
Inheritance ↳ object
Syntax Constructor NtlmAuthenticator()
Authenticate with the credentials of the currently logged in user
Syntax Constructor NtlmAuthenticator(String, String)
Authenticate by impersonation
Syntax Parameters Name Type Description username
string
password
string
Constructor NtlmAuthenticator(ICredentials)
Authenticate by impersonation, using an existing ICredentials
instance
Syntax Parameters Name Type Description credentials
ICredentials
Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Class OAuth1Authenticator
See also RFC: The OAuth 1.0 Protocol (opens new window)
Inheritance ↳ object
Syntax Property Realm
Syntax Property ParameterHandling
Syntax Property SignatureMethod
Syntax Property SignatureTreatment
Syntax Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Method ForRequestToken(String, String, OAuthSignatureMethod)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
signatureMethod
RestSharp.Authenticators.OAuth.OAuthSignatureMethod
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForRequestToken(String, String, String)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
callbackUrl
string
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForAccessToken(String, String, String, String, OAuthSignatureMethod)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
token
string
tokenSecret
string
signatureMethod
RestSharp.Authenticators.OAuth.OAuthSignatureMethod
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForAccessToken(String, String, String, String, String)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
token
string
tokenSecret
string
verifier
string
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForAccessTokenRefresh(String, String, String, String, String)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
token
string
tokenSecret
string
sessionHandle
string
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForAccessTokenRefresh(String, String, String, String, String, String)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
token
string
tokenSecret
string
verifier
string
sessionHandle
string
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForClientAuthentication(String, String, String, String, OAuthSignatureMethod)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
username
string
password
string
signatureMethod
RestSharp.Authenticators.OAuth.OAuthSignatureMethod
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Method ForProtectedResource(String, String, String, String, OAuthSignatureMethod)
Syntax Parameters Name Type Description consumerKey
string
consumerSecret
string
accessToken
string
accessTokenSecret
string
signatureMethod
RestSharp.Authenticators.OAuth.OAuthSignatureMethod
Returns Type Description RestSharp.Authenticators.OAuth1Authenticator
Class OAuth2Authenticator
Base class for OAuth 2 Authenticators.
Since there are many ways to authenticate in OAuth2,
this is used as a base class to differentiate between
other authenticators.
Any other OAuth2 authenticators must derive from this
abstract class.
Inheritance ↳ object
Syntax Constructor OAuth2Authenticator(String)
Syntax Parameters Name Type Description accessToken
string
Property AccessToken
Gets the access token.
Syntax Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Method GetAuthenticationParameter(String)
Syntax Parameters Name Type Description accessToken
string
Returns Type Description RestSharp.Parameter
The OAuth 2 authenticator using the authorization request header field.
Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1
Inheritance ↳ object
↳ RestSharp.Authenticators.AuthenticatorBase
Syntax Syntax Parameters Name Type Description accessToken
string
Syntax Parameters Name Type Description accessToken
string
tokenType
string
Method GetAuthenticationParameter(String)
Syntax Parameters Name Type Description accessToken
string
Returns Type Description RestSharp.Parameter
Class OAuth2UriQueryParameterAuthenticator
The OAuth 2 authenticator using URI query parameter.
Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2
Inheritance ↳ object
↳ RestSharp.Authenticators.AuthenticatorBase
Syntax Constructor OAuth2UriQueryParameterAuthenticator(String)
Syntax Parameters Name Type Description accessToken
string
Method GetAuthenticationParameter(String)
Syntax Parameters Name Type Description accessToken
string
Returns Type Description RestSharp.Parameter
Class SimpleAuthenticator
Inheritance ↳ object
Syntax Constructor SimpleAuthenticator(String, String, String, String)
Syntax Parameters Name Type Description usernameKey
string
username
string
passwordKey
string
password
string
Method Authenticate(IRestClient, IRestRequest)
Syntax Parameters Name Type Description client
RestSharp.IRestClient
request
RestSharp.IRestRequest
Namespace: RestSharp.Authenticators.OAuth Enum OAuthSignatureMethod
Syntax Fields Name Description HmacSha1 HmacSha256 PlainText RsaSha1
Enum OAuthSignatureTreatment
Syntax Fields Name Description Escaped Unescaped
Enum OAuthParameterHandling
Syntax Fields Name Description HttpAuthorizationHeader UrlOrPostParameters
Enum OAuthType
Syntax Fields Name Description RequestToken AccessToken ProtectedResource ClientAuthentication
Namespace: RestSharp.Extensions Class MiscExtensions
Extension method overload!
Inheritance ↳ object
Syntax Method SaveAs(Byte[], String)
Save a byte array to a file
Syntax Parameters Name Type Description input
byte[]
Bytes to save path
string
Full path to save file to
Method ReadAsBytes(Stream)
Read a stream into a byte array
Syntax Parameters Name Type Description input
System.IO.Stream
Stream to read
Returns Type Description byte[]
byte[]
Method CopyTo(Stream, Stream)
Copies bytes from one stream to another
Syntax Parameters Name Type Description input
System.IO.Stream
The input stream. output
System.IO.Stream
The output stream.
Method AsString(Byte[], String)
Converts a byte array to a string, using its byte order mark to convert it to the right encoding.
http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx
Syntax Parameters Name Type Description buffer
byte[]
An array of bytes to convert encoding
string
Content encoding. Will fallback to UTF8 if not a valid encoding.
Returns Type Description string
The byte as a string.
Method AsString(Byte[])
Converts a byte array to a string, using its byte order mark to convert it to the right encoding.
http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx
Syntax Parameters Name Type Description buffer
byte[]
An array of bytes to convert
Returns Type Description string
The byte as a string using UTF8.
Class ReflectionExtensions
Reflection extensions
Inheritance ↳ object
Syntax Method GetAttribute<T>(MemberInfo)
Retrieve an attribute from a member (property)
Syntax Generic parameters Name Description T
Type of attribute to retrieve
Parameters Name Type Description prop
System.Reflection.MemberInfo
Member to retrieve attribute from
Returns Method GetAttribute<T>(Type)
Retrieve an attribute from a type
Syntax Generic parameters Name Description T
Type of attribute to retrieve
Parameters Name Type Description type
System.Type
Type to retrieve attribute from
Returns Method IsSubclassOfRawGeneric(Type, Type)
Checks a type to see if it derives from a raw generic (e.g. List[[]])
Syntax Parameters Name Type Description toCheck
System.Type
generic
System.Type
Returns Method FindEnumValue(Type, String, CultureInfo)
Find a value from a System.Enum by trying several possible variants
of the string value of the enum.
Syntax Parameters Name Type Description type
System.Type
Type of enum value
string
Value for which to search culture
System.Globalization.CultureInfo
The culture used to calculate the name variants
Returns Class ResponseExtensions
Inheritance ↳ object
Syntax Method ToAsyncResponse<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Type Description RestSharp.IRestResponse<T>
Class ResponseStatusExtensions
Inheritance ↳ object
Syntax Method ToWebException(ResponseStatus)
Syntax Parameters Name Type Description responseStatus
RestSharp.ResponseStatus
Returns Type Description WebException
Class RSACryptoServiceProviderExtensions
Inheritance ↳ object
Syntax Method FromXmlString2(RSACryptoServiceProvider, String)
Imports the specified XML String into the crypto service provider
.NET Core 2.0 doesn't provide an implementation of RSACryptoServiceProvider.FromXmlString/ToXmlString, so we have
to do it ourselves.
Source: https://gist.github.com/Jargon64/5b172c452827e15b21882f1d76a94be4/
Syntax Parameters Name Type Description rsa
RSACryptoServiceProvider
xmlString
string
Class StringExtensions
Inheritance ↳ object
Syntax Method UrlDecode(String)
Syntax Parameters Name Type Description input
string
Returns Method UrlEncode(String)
Uses Uri.EscapeDataString() based on recommendations on MSDN
http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx
Syntax Parameters Name Type Description input
string
Returns Method UrlEncode(String, Encoding)
Syntax Parameters Name Type Description input
string
encoding
System.Text.Encoding
Returns Method HasValue(String)
Check that a string is not null or empty
Syntax Parameters Name Type Description input
string
String to check
Returns Type Description bool
bool
Method RemoveUnderscoresAndDashes(String)
Remove underscores from a string
Syntax Parameters Name Type Description input
string
String to process
Returns Type Description string
string
Method ParseJsonDate(String, CultureInfo)
Parses most common JSON date formats
Syntax Parameters Name Type Description input
string
JSON value to parse culture
System.Globalization.CultureInfo
Returns Type Description System.DateTime
DateTime
Method ToPascalCase(String, CultureInfo)
Converts a string to pascal case
Syntax Parameters Name Type Description lowercaseAndUnderscoredWord
string
String to convert culture
System.Globalization.CultureInfo
Returns Type Description string
string
Method ToPascalCase(String, Boolean, CultureInfo)
Converts a string to pascal case with the option to remove underscores
Syntax Parameters Name Type Description text
string
String to convert removeUnderscores
bool
Option to remove underscores culture
System.Globalization.CultureInfo
Returns Method ToCamelCase(String, CultureInfo)
Converts a string to camel case
Syntax Parameters Name Type Description lowercaseAndUnderscoredWord
string
String to convert culture
System.Globalization.CultureInfo
Returns Type Description string
String
Method MakeInitialLowerCase(String)
Convert the first letter of a string to lower case
Syntax Parameters Name Type Description word
string
String to convert
Returns Type Description string
string
Method AddUnderscores(String)
Add underscores to a pascal-cased string
Syntax Parameters Name Type Description pascalCasedWord
string
String to convert
Returns Type Description string
string
Method AddDashes(String)
Add dashes to a pascal-cased string
Syntax Parameters Name Type Description pascalCasedWord
string
String to convert
Returns Type Description string
string
Method AddUnderscorePrefix(String)
Add an underscore prefix to a pascal-cased string
Syntax Parameters Name Type Description pascalCasedWord
string
Returns Method AddSpaces(String)
Add spaces to a pascal-cased string
Syntax Parameters Name Type Description pascalCasedWord
string
String to convert
Returns Type Description string
string
Method GetNameVariants(String, CultureInfo)
Return possible variants of a name for name matching.
Syntax Parameters Name Type Description name
string
String to convert culture
System.Globalization.CultureInfo
The culture to use for conversion
Returns Type Description System.Collections.Generic.IEnumerable<string>
IEnumerable<string>
Class WebRequestExtensions
Inheritance ↳ object
Syntax Method GetRequestStreamAsync(WebRequest, CancellationToken)
Syntax Parameters Name Type Description webRequest
WebRequest
cancellationToken
System.Threading.CancellationToken
Returns Type Description System.Threading.Tasks.Task<System.IO.Stream>
Method GetResponseAsync(WebRequest, CancellationToken)
Syntax Parameters Name Type Description webRequest
WebRequest
cancellationToken
System.Threading.CancellationToken
Returns Type Description System.Threading.Tasks.Task<WebResponse>
Class XmlExtensions
XML Extension Methods
Inheritance ↳ object
Syntax Method AsNamespaced(String, String)
Returns the name of an element with the namespace if specified
Syntax Parameters Name Type Description name
string
Element name namespace
string
XML Namespace
Returns Namespace: RestSharp.Serialization Class ContentType
Inheritance ↳ object
Syntax Field Json
Syntax Field Xml
Syntax Syntax Field JsonAccept
Syntax Field XmlAccept
Syntax Interface IRestSerializer
Syntax Property SupportedContentTypes
Syntax Syntax Method Serialize(Parameter)
Syntax Parameters Name Type Description parameter
RestSharp.Parameter
Returns Interface IWithRootElement
Syntax Property RootElement
Syntax Namespace: RestSharp.Serialization.Json Class JsonSerializer
Inheritance ↳ object
Syntax Syntax Property Culture
Syntax Method Serialize(Object)
Serialize the object as JSON
If the object is already a serialized string returns it's value
Syntax Parameters Name Type Description obj
object
Object to serialize
Returns Type Description string
JSON as String
Property ContentType
Content type for serialized content
Syntax Property SupportedContentTypes
Syntax Syntax Method Serialize(Parameter)
Syntax Parameters Name Type Description parameter
RestSharp.Parameter
Returns Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Property RootElement
Syntax Class JsonDeserializer
Inheritance ↳ object
↳ RestSharp.Serialization.Json.JsonSerializer
Inherited members RestSharp.Serialization.Json.JsonSerializer.DateFormat
Syntax Namespace: RestSharp.Serialization.Xml Class DotNetXmlSerializerClientExtensions
Inheritance ↳ object
Syntax Method UseDotNetXmlSerializer(IRestClient, String, Encoding)
Syntax Parameters Name Type Description restClient
RestSharp.IRestClient
xmlNamespace
string
encoding
System.Text.Encoding
Returns Type Description RestSharp.IRestClient
Interface IXmlDeserializer
Syntax Property Namespace
Syntax Syntax Interface IXmlSerializer
Syntax Property Namespace
Syntax Syntax Class XmlAttributeDeserializer
Inheritance ↳ object
↳ RestSharp.Deserializers.XmlDeserializer
Syntax Method GetValueFromXml(XElement, XName, PropertyInfo, Boolean)
Syntax Parameters Name Type Description root
XElement
name
XName
prop
System.Reflection.PropertyInfo
useExactName
bool
Returns Class XmlRestSerializer
Inheritance ↳ object
Syntax Property SupportedContentTypes
Syntax Syntax Property ContentType
Syntax Method Serialize(Object)
Syntax Parameters Name Type Description obj
object
Returns Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Method Serialize(Parameter)
Syntax Parameters Name Type Description parameter
RestSharp.Parameter
Returns Property RootElement
Syntax Property Namespace
Syntax Syntax Method WithOptions(XmlSerilizationOptions)
Syntax Parameters Name Type Description options
RestSharp.Serialization.Xml.XmlSerilizationOptions
Returns Type Description RestSharp.Serialization.Xml.XmlRestSerializer
Method WithXmlSerializer<T>(XmlSerilizationOptions)
Syntax Generic parameters Parameters Name Type Description options
RestSharp.Serialization.Xml.XmlSerilizationOptions
Returns Type Description RestSharp.Serialization.Xml.XmlRestSerializer
Method WithXmlSerializer(IXmlSerializer)
Syntax Parameters Name Type Description xmlSerializer
RestSharp.Serialization.Xml.IXmlSerializer
Returns Type Description RestSharp.Serialization.Xml.XmlRestSerializer
Method WithXmlDeserialzier<T>(XmlSerilizationOptions)
Syntax Generic parameters Parameters Name Type Description options
RestSharp.Serialization.Xml.XmlSerilizationOptions
Returns Type Description RestSharp.Serialization.Xml.XmlRestSerializer
Method WithXmlDeserializer(IXmlDeserializer)
Syntax Parameters Name Type Description xmlDeserializer
RestSharp.Serialization.Xml.IXmlDeserializer
Returns Type Description RestSharp.Serialization.Xml.XmlRestSerializer
Class XmlSerilizationOptions
Inheritance ↳ object
Syntax Property RootElement
Name of the root element to use when serializing
Syntax Property Namespace
XML namespace to use when serializing
Syntax Format string to use when serializing dates
Syntax Property Culture
Syntax Property Default
Syntax Namespace: RestSharp.Deserializers Class DeserializeAsAttribute
Allows control how class and property names and values are deserialized by XmlAttributeDeserializer
Inheritance ↳ object
↳ System.Attribute
Syntax Property Name
The name to use for the serialized element
Syntax Property Attribute
Sets if the property to Deserialize is an Attribute or Element (Default: false)
Syntax Property Content
Sets if the property to Deserialize is a content of current Element (Default: false)
Syntax Interface IDeserializer
Syntax Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Class DotNetXmlDeserializer
Wrapper for System.Xml.Serialization.XmlSerializer.
Inheritance ↳ object
Syntax Property Encoding
Encoding for serialized content
Syntax Property RootElement
Name of the root element to use when serializing
Syntax Property Namespace
XML namespace to use when serializing
Syntax Syntax Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Class XmlDeserializer
Inheritance ↳ object
Syntax Constructor XmlDeserializer()
Syntax Property Culture
Syntax Property RootElement
Syntax Property Namespace
Syntax Syntax Method Deserialize<T>(IRestResponse)
Syntax Generic parameters Parameters Name Type Description response
RestSharp.IRestResponse
Returns Method Map(Object, XElement)
Syntax Parameters Name Type Description x
object
root
XElement
Returns Method CreateAndMap(Type, XElement)
Syntax Parameters Name Type Description t
System.Type
element
XElement
Returns Method GetValueFromXml(XElement, XName, PropertyInfo, Boolean)
Syntax Parameters Name Type Description root
XElement
name
XName
prop
System.Reflection.PropertyInfo
useExactName
bool
Returns Method GetElementByName(XElement, XName)
Syntax Parameters Name Type Description root
XElement
name
XName
Returns Type Description XElement
Method GetAttributeByName(XElement, XName, Boolean)
Syntax Parameters Name Type Description root
XElement
name
XName
useExactName
bool
Returns Type Description XAttribute
Namespace: RestSharp.Serializers Interface ISerializer
Syntax Property ContentType
Syntax Method Serialize(Object)
Syntax Parameters Name Type Description obj
object
Returns Class SerializeAsAttribute
Allows control how class and property names and values are serialized by XmlSerializer
Currently not supported with the JsonSerializer
When specified at the property level the class-level specification is overridden
Inheritance ↳ object
↳ System.Attribute
Syntax Constructor SerializeAsAttribute()
Syntax Property Name
The name to use for the serialized element
Syntax Property Attribute
Sets the value to be serialized as an Attribute instead of an Element
Syntax Property Content
Sets the value to be serialized as text content of current Element instead of an new Element
Syntax Property Culture
The culture to use when serializing
Syntax Property NameStyle
Transforms the casing of the name based on the selected value.
Syntax Property Index
The order to serialize the element. Default is int.MaxValue.
Syntax Called by the attribute when NameStyle is speficied
Syntax Parameters Name Type Description input
string
The string to transform
Returns Type Description string
String
Enum NameStyle
Options for transforming casing of element names
Syntax Fields Name Description AsIs CamelCase LowerCase PascalCase
Class DotNetXmlSerializer
Wrapper for System.Xml.Serialization.XmlSerializer.
Inheritance ↳ object
Syntax Constructor DotNetXmlSerializer()
Default constructor, does not specify namespace
Syntax Constructor DotNetXmlSerializer(String)
Specify the namespaced to be used when serializing
Syntax Parameters Name Type Description namespace
string
XML namespace
Property Encoding
Encoding for serialized content
Syntax Method Serialize(Object)
Serialize the object as XML
Syntax Parameters Name Type Description obj
object
Object to serialize
Returns Type Description string
XML as string
Property RootElement
Name of the root element to use when serializing
Syntax Property Namespace
XML namespace to use when serializing
Syntax Format string to use when serializing dates
Syntax Property ContentType
Content type for serialized content
Syntax Class XmlSerializer
Default XML Serializer
Inheritance ↳ object
Syntax Constructor XmlSerializer()
Default constructor, does not specify namespace
Syntax Constructor XmlSerializer(String)
Specify the namespaced to be used when serializing
Syntax Parameters Name Type Description namespace
string
XML namespace
Method Serialize(Object)
Serialize the object as XML
Syntax Parameters Name Type Description obj
object
Object to serialize
Returns Type Description string
XML as string
Property RootElement
Name of the root element to use when serializing
Syntax Property Namespace
XML namespace to use when serializing
Syntax Format string to use when serializing dates
Syntax Property ContentType
Content type for serialized content
Syntax Namespace: RestSharp.Validation Class Ensure
Inheritance ↳ object
Syntax Method NotNull(Object, String)
Syntax Parameters Name Type Description parameter
object
name
string
Method NotEmpty(String, String)
Syntax Parameters Name Type Description parameter
string
name
string
Class Require
Helper methods for validating required values
Inheritance ↳ object
Syntax Method Argument(String, Object)
Require a parameter to not be null
Syntax Parameters Name Type Description argumentName
string
Name of the parameter argumentValue
object
Value of the parameter
Class Validate
Helper methods for validating values
Inheritance ↳ object
Syntax Method IsBetween(Int32, Int32, Int32)
Validate an integer value is between the specified values (exclusive of min/max)
Syntax Parameters Name Type Description value
int
Value to validate min
int
Exclusive minimum value max
int
Exclusive maximum value
Method IsValidLength(String, Int32)
Validate a string length
Syntax Parameters Name Type Description value
string
String to be validated maxSize
int
Maximum length of the string