138 namespace RestClient {
156 const DeserializeYaml = (
160 const DeserializeXml = (
163 "in":
hash (
string xml, reference<string>
type) {
165 on_success type =
"xml";
166 return parse_xmlrpc_value(xml);
168 catch (hash<ExceptionInfo> ex);
455 hash get(
string path,
auto body, *reference<hash> info, *
hash hdr);
493 hash put(
string path,
auto body, *reference<hash> info, *
hash hdr);
531 hash patch(
string path,
auto body, *reference<hash> info, *
hash hdr);
569 hash post(
string path,
auto body, *reference<hash> info, *
hash hdr);
607 hash del(
string path,
auto body, *reference<hash> info, *
hash hdr);
621 nothing
prepareMsg(
string method,
string path, reference body, reference<hash> hdr,
string ct =
"Content-Type");
671 hash doRequest(
string m,
string path,
auto body, *reference<hash> info, softbool decode_errors =
True, *
hash hdr);
720 "send_encoding":
True,
721 "content_encoding":
True,
725 const OptionList =
Options.keys();
this class provides the REST client API
Definition: RestClient.qm.dox.h:141
string getType()
returns "rest"
const Version
RestClient Version.
Definition: RestClient.qm.dox.h:187
string sprintf(string fmt,...)
const AcceptList
Accept header list.
Definition: RestClient.qm.dox.h:174
const DataSerializationSupport
Data serialization support mapping codes to MIME types and de/serialization functions.
Definition: RestClient.qm.dox.h:146
hash getOptions()
gets options
hash real_opts
real options used when creating an object
Definition: RestClient.qm.dox.h:715
addDefaultHeaders(hash h)
adds default headers to each request; these headers will be sent in all requests but can be overridde...
setSendEncoding(string enc="auto")
change the data content encoding (compression) option for the object; see EncodingSupport for valid o...
const DefaultHeaders
default HTTP headers (Content-Type is added before sending)
Definition: RestClient.qm.dox.h:193
hash getDefaultHeaders()
returns the hash of default headers to sent in all requests
const Options
RestConnection object connection options.
Definition: RestClient.qm.dox.h:718
RestClient getImpl(bool connect=True, *hash rtopts)
returns a RestClient::RestClient object
const DataSerializationOptions
Data serialization options; this is a hash to simulate a set of strings.
Definition: RestClient.qm.dox.h:209
const Accept
Accept header value.
Definition: RestClient.qm.dox.h:184
const MimeTypeOctetStream
hash doRequest(string m, string path, auto body, *reference< hash > info, softbool decode_errors=True, *hash hdr)
sends an HTTP request to the REST server and returns the response
const MimeTypeFormUrlEncoded
hash post(string path, auto body, *reference< hash > info, *hash hdr)
sends an HTTP POST request to the REST server and returns the response
*hash getDefaultOptions()
returns default options
RestSchemaValidator::AbstractRestSchemaValidator getValidator()
returns the current validator object
static decodeError(hash h, *reference< hash > info)
decode any REST errors returned if possible
constructor(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
creates the RestConnection object
const VersionString
RestClient Version String.
Definition: RestClient.qm.dox.h:190
string getSerialization()
returns the current data serialization format currently in effect for the object (see DataSerializati...
binary bzip2(binary bin, softint level=BZ2_DEFAULT_COMPRESSION)
*string getSendEncoding()
returns the current data content encoding (compression) object or NOTHING if no encoding option is se...
binary gzip(string str, int level=Z_DEFAULT_COMPRESSION)
const CompressionThreshold
default threadhold for data compressions; transfers smaller than this size will not be compressed ...
Definition: RestClient.qm.dox.h:246
hash patch(string path, auto body, *reference< hash > info, *hash hdr)
sends an HTTP PATCH request to the REST server and returns the response
nothing prepareMsg(string method, string path, reference body, reference< hash > hdr, string ct="Content-Type")
sets up the Content-Type header and encodes any body for sending
hash sendAndDecodeResponse(*data body, string m, string path, hash hdr, *reference< hash > info, *softbool decode_errors)
sends the outgoing HTTP message and recodes the response to data
nothing preparePath(reference< string > path)
sets up the path for the HTTP request URI
class for REST HTTP connections; returns RestClient::RestClient objects
Definition: RestClient.qm.dox.h:710
hash del(string path, auto body, *reference< hash > info, *hash hdr)
sends an HTTP DELETE request to the REST server and returns the response
static RestConnection make(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
static constructor
setSerialization(string data="auto")
change the serialization option for the object; see DataSerializationOptions for valid options ...
hash put(string path, auto body, *reference< hash > info, *hash hdr)
sends an HTTP PUT request to the REST server and returns the response
setContentEncoding(string enc="auto")
sets the request and desired response encoding for the object; see EncodingSupport for valid options ...
const EncodingSupport
Send content encoding options.
Definition: RestClient.qm.dox.h:227
binary compress(string str, int level=Z_DEFAULT_COMPRESSION)