Qore RestClient Module Reference
1.6
|
The RestClient module provides an API for calling REST services.
To use this module, use "%requires RestClient"
in your code.
All the public symbols in the module are defined in the RestClient namespace.
The main classes are:
The RestClient class can support the following methods of data serialization:
"json"
: using the "json"
module; messages bodies are encoded using JSON"rawxml"
: using the "xml"
module; message bodies are encoded with XML without any data type encodings"url"
: message bodies are encoded in URL form encoded format (see RFC 2738 2.2)"xml"
: using the "xml"
module; message bodies are encoded using XML-RPC value encoding"yaml"
: using the "yaml"
module; message bodies are encoded using YAML"text"
: message bodies are not serialized, plain text value is used"bin"
: message bodies are not serialized, binary data is used insteadIf none of the above modules can be loaded by the RestClient module, then the RestClient module will fail to initialize.
Runtime REST API validation against a REST schema is supported; see the validator
and swagger
options in RestClient::constructor().
For maximum compatibility with other REST solutions, the "json"
encoding method is the default when no other encoding method is chosen and the "json"
module is available.
"rest"
in the bin directory for a user-friendly command-line interface to REST functionality and a more detailed example of code using this module.GET
requests to be made with a message body, but this is bad practice and not compliant with HTTP 1.1 RFCs and therefore could lead to compatibility problems; see HTTP GET Requests With a Message Body for more information"response-code"
key of the info output hash could be missing in some clases (issue 3237)"bin"
serialization method (issue 2816)text/plain
Content-Type"PATCH"
method"url"
encoding for URL form encoded message bodies (issue 1436)"rawxml"
data type; when parsing XML responses, if the XML cannot be parsed as XML-RPC data, then it's attempted to be parsed as untyped XML data (issue 1437)"content_encoding"
option for the RestClient constructor"gzip"
the default content encoding"/"
chars were sometimes present in the request URI path"Content-Type"
header in requests"Accept"
header in requests