Skip to main content

RESTful client

Anatomy

<rest:client timeout="30" url="string" validate="bool">
ixml
<rest:header>string</rest:header>
</rest:client>

Description: REST:CLIENT defines a set of dynamically bound RESTful resources based on HTTP/1.1.

Attributes

NameTypeDescriptionDefined By
timeoutintTimeout in seconds rest:client
urlstringURL rest:client
validateboolValidate SSL rest:client

Children

rest:header

Anatomy of REST header

<rest:header>string</rest:header>

Examples

Example

<rest:client url="https://api.predic8.de/shop">
<rest:header>
Content-Type: application/json
</rest:header>

<rest:bind var="createProduct" method="POST">/products/</rest:bind>
<rest:bind var="updateProduct" method="PATCH">/products/:id</rest:bind>
<rest:bind var="getProduct" method="GET">/products/:id</rest:bind>
</rest:client>

<decode:json var="data">
<call func="createProduct">
<param>{"name": "Some Fruit", "price": 4.99}</param>
</call>
</decode:json>

<match var_matches="matches" pattern="/\d+/">$data.product_url</match>
<set var="id">$matches[0][0]</set>

<call func="updateProduct">
<param var="id"/>
<param>{"name": "Wildberries"}</param>
</call>

<decode:json var="data">
<call func="getProduct">
<param var="id"/>
</call>
</decode:json>

<output>$data.name</output>

<!-- Wildberries -->