Class Rest
REST Class for CRUD Transactions.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Utilities
Assembly: cs.temp.dll.dll
Syntax
public static class Rest
Properties
UseSSL
Use SSL Connections when making rest calls.
Declaration
public static bool UseSSL { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
DeleteAsync(String, Dictionary<String, String>, Int32)
Rest DELETE.
Declaration
public static Task<Response> DeleteAsync(string query, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
GetAsync(String, Dictionary<String, String>, Int32)
Rest GET.
Declaration
public static Task<Response> GetAsync(string query, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
GetBasicAuthentication(String, String)
Gets the Basic auth header.
Declaration
public static string GetBasicAuthentication(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
String | username | The Username. |
String | password | The password. |
Returns
Type | Description |
---|---|
String | The Basic authorization header encoded to base 64. |
GetBearerOAuthToken(String)
Gets the Bearer auth header.
Declaration
public static string GetBearerOAuthToken(string authToken)
Parameters
Type | Name | Description |
---|---|---|
String | authToken | OAuth Token to be used. |
Returns
Type | Description |
---|---|
String | The Bearer authorization header. |
PostAsync(String, Dictionary<String, String>, Int32)
Rest POST.
Declaration
public static Task<Response> PostAsync(string query, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
PostAsync(String, Byte[], Dictionary<String, String>, Int32)
Rest POST.
Declaration
public static Task<Response> PostAsync(string query, byte[] bodyData, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
Byte[] | bodyData | The raw data to post. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
PostAsync(String, String, Dictionary<String, String>, Int32)
Rest POST.
Declaration
public static Task<Response> PostAsync(string query, string jsonData, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
String | jsonData | JSON data for the request. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
PostAsync(String, WWWForm, Dictionary<String, String>, Int32)
Rest POST.
Declaration
public static Task<Response> PostAsync(string query, WWWForm formData, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
WWWForm | formData | Form Data. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
PutAsync(String, Byte[], Dictionary<String, String>, Int32)
Rest PUT.
Declaration
public static Task<Response> PutAsync(string query, byte[] bodyData, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
Byte[] | bodyData | Data to be submitted. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |
PutAsync(String, String, Dictionary<String, String>, Int32)
Rest PUT.
Declaration
public static Task<Response> PutAsync(string query, string jsonData, Dictionary<string, string> headers = null, int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
String | query | Finalized Endpoint Query with parameters. |
String | jsonData | Data to be submitted. |
Dictionary<String, String> | headers | Optional header information for the request. |
Int32 | timeout | Optional time in seconds before request expires. |
Returns
Type | Description |
---|---|
Task<Response> | The response data. |