SpringCard LibCs for .NET  18.10.10
A set of utilities to simplify the development of .NET application
SpringCard.LibCs.RestClient Class Reference

A simple REST client, to access a remote REST API through HTTP or HTTPS. More...

Public Member Functions

JSONObject GET_Json (string Url)
 GET a JSON object from the REST server.
 
JSONObject POST_Json (string Url, JSON Data)
 POST a JSON object to the REST server, and receive a JSON object in response.
 
JSONObject POST_Json (string Url, JSONObject Data)
 POST a JSON object to the REST server, and receive a JSON object in response.
 
JSONObject POST_Json (string Url, string ContentData, string ContentType="application/json")
 POST a JSON object to the REST server, and receive a JSON object in response.
 
bool DownloadTextFile (string Url, string LocalFileName)
 GET a content from the server, and save it (as text) into a local file.
 
 RestClient (bool IgnoreHttpsCertificateError=false)
 Instanciate a new REST client.
 
 RestClient (string BaseUrl, bool IgnoreHttpsCertificateError=false)
 Instanciate a new REST client, using the specified URL as the base for all requests.
 
 RestClient (string BaseUrl, string UserName, string UserPassword, bool IgnoreHttpsCertificateError=false)
 Instanciate a new REST client, using the specified URL as the base for all requests, with HTTP authentication.
 

Static Public Member Functions

static void SetIgnoreHttpsCertificateError ()
 
static HttpWebResponse GET (string Url, NetworkCredential Credentials=null)
 
static HttpWebResponse POST (string Url, string ContentData, string ContentType, NetworkCredential Credentials=null)
 
static JSONObject ResponseToJSON (HttpWebResponse Response)
 
static void ResponseToTextFile (HttpWebResponse Response, string FileName)
 

Public Attributes

bool ThrowExceptions = false
 

Protected Member Functions

string ActualUrl (string RelativeUrl)
 

Protected Attributes

NetworkCredential Credentials = null
 

Detailed Description

A simple REST client, to access a remote REST API through HTTP or HTTPS.


The documentation for this class was generated from the following file: