Medical Imaging Interaction Toolkit  2023.12.00
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 ( )

◆ ~RESTClient()

mitk::RESTClient::~RESTClient ( )

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
headersthe additional headers to be set to the HTTP request
Returns
task to wait for with resulting json object

◆ 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
filePath
headersthe additional headers to be set to the HTTP request
Returns
task to wait for returning an empty json object

◆ Post() [1/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

◆ Post() [2/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

◆ 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

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