Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::RESTClient Class Reference

#include <mitkRESTClient.h>

Public Types

using http_request = web::http::http_request
 

Public Member Functions

 RESTClient ()
 
 ~RESTClient ()
 
pplx::task< web::json::value > Get (const web::uri &uri, const std::map< utility::string_t, utility::string_t > headers)
 Executes a HTTP GET request with the given uri and returns a task waiting for a json object. More...
 
pplx::task< web::json::value > Get (const web::uri &uri, const utility::string_t &filePath, const std::map< utility::string_t, utility::string_t > headers)
 Executes a HTTP GET request with the given uri and and stores the byte stream in a file given by the filePath. More...
 
pplx::task< web::json::value > Put (const web::uri &uri, const web::json::value *content)
 Executes a HTTP PUT request with given uri and the content given as json. More...
 
pplx::task< web::json::value > Post (const web::uri &uri, const web::json::value *content, const std::map< utility::string_t, utility::string_t > headers)
 Executes a HTTP POST request with given uri and the content given as json. More...
 
pplx::task< web::json::value > Post (const web::uri &uri, const std::vector< unsigned char > *content, const std::map< utility::string_t, utility::string_t > headers)
 Executes a HTTP POST request with given uri and the content given as json. More...
 

Detailed Description

Definition at line 21 of file mitkRESTClient.h.

Member Typedef Documentation

◆ http_request

using mitk::RESTClient::http_request = web::http::http_request

Definition at line 24 of file mitkRESTClient.h.

Constructor & Destructor Documentation

◆ RESTClient()

mitk::RESTClient::RESTClient ( )

Definition at line 28 of file mitkRESTClient.cpp.

◆ ~RESTClient()

mitk::RESTClient::~RESTClient ( )

Definition at line 33 of file mitkRESTClient.cpp.

References mitk::RESTUtil::convertToUtf8(), MITK_DEBUG, MITK_WARN, mitkThrow, and OK.

Member Function Documentation

◆ Get() [1/2]

pplx::task< web::json::value > mitk::RESTClient::Get ( const web::uri &  uri,
const std::map< utility::string_t, utility::string_t >  headers 
)

Executes a HTTP GET request with the given uri and returns a task waiting for a json object.

Exceptions
mitk::Exceptionif request went wrong
Parameters
urithe URI resulting the target of the HTTP request
theadditional headers to be set to the HTTP request
Returns
task to wait for with resulting json object

Definition at line 57 of file mitkRESTClient.cpp.

References MITK_INFO, and mitkThrow.

◆ Get() [2/2]

pplx::task< web::json::value > mitk::RESTClient::Get ( const web::uri &  uri,
const utility::string_t &  filePath,
const std::map< utility::string_t, utility::string_t >  headers 
)

Executes a HTTP GET request with the given uri and and stores the byte stream in a file given by the filePath.

Exceptions
mitk::Exceptionif request went wrong
Parameters
urithe URI resulting the target of the HTTP request
theadditional headers to be set to the HTTP request
Returns
task to wait for returning an empty json object

Definition at line 85 of file mitkRESTClient.cpp.

References mitk::RESTUtil::convertToUtf8(), MITK_INFO, mitkThrow, and OK.

◆ Post() [1/2]

pplx::task< web::json::value > mitk::RESTClient::Post ( const web::uri &  uri,
const web::json::value *  content,
const std::map< utility::string_t, utility::string_t >  headers 
)

Executes a HTTP POST request with given uri and the content given as json.

Exceptions
mitk::Exceptionif request went wrong
Parameters
uridefines the URI resulting the target of the HTTP request
contentthe content as json value which should be the body of the request and thus the content of the created resource
headersthe additional headers to be set to the HTTP request
Returns
task to wait for with resulting json object

Definition at line 161 of file mitkRESTClient.cpp.

References MITK_INFO, and mitkThrow.

◆ Post() [2/2]

pplx::task< web::json::value > mitk::RESTClient::Post ( const web::uri &  uri,
const std::vector< unsigned char > *  content,
const std::map< utility::string_t, utility::string_t >  headers 
)

Executes a HTTP POST request with given uri and the content given as json.

Exceptions
mitk::Exceptionif request went wrong
Parameters
uridefines the URI resulting the target of the HTTP request
contentthe content as json value which should be the body of the request and thus the content of the created resource
headersthe additional headers to be set to the HTTP request
Returns
task to wait for with resulting json object

Definition at line 148 of file mitkRESTClient.cpp.

◆ Put()

pplx::task< web::json::value > mitk::RESTClient::Put ( const web::uri &  uri,
const web::json::value *  content 
)

Executes a HTTP PUT request with given uri and the content given as json.

Exceptions
mitk::Exceptionif request went wrong
Parameters
uridefines the URI resulting the target of the HTTP request
contentthe content as json value which should be the body of the request and thus the content of the created resources
Returns
task to wait for with resulting json object

Definition at line 123 of file mitkRESTClient.cpp.

References MITK_INFO, and mitkThrow.


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