HttpRequest
The HttpRequest
verb sends a request to the external servers. It consists of 2 child nodes Request
and Response
Attributes
ATTRIBUTE | DESCRIPTION | OPTIONS | DEFAULT |
---|---|---|---|
async | Defines if TeXML process should wait for the request response. When it is set to false, the callback will be sent to the action URL, when the request is processed | false | |
action | Defines the action url that will be used to send the callback when the request is processed (only if async is set to false) | - |
Child verbs/nouns
NOUN/VERB | DESCRIPTION |
---|---|
Request | The Request node defines all the attributes of the request. It can have 2 child nodes
Headers and Body |
Response | The Response node defines all the attributes of the response. It can have 2 child nodes
Headers and Body |
Example
<Response>
<HttpRequest async=”true”>
<Request url="https://example.com" method="POST">
<Headers>
<Header>
<Key>Authorization</Key>
<Value>Bearer API_key</Value>
</Header>
<Header>
<Key>Content-Type</Key>
<Value>application/json</Value>
</Header>
</Headers>
<Body>
<![CDATA[
{
"from":{{From}}
}
]]>
</Body>
</Request>
</HttpRequest>
</Response>
<Response>
<HttpRequest async=”false” action="https://example.com">
<Request url="https://example.com" method="POST">
...
</Request>
<Response>
<Type>JSON</Type>
<StatusCode>200</StatusCode>
<Content>
<Field>
<Name>contact.name.first</Name>
<Value>first_name</Value>
</Field>
<Field>
<Name>contact.name.last</Name>
<Value>last_name</Value>
</Field>
</Content>
</Response>
</HttpRequest>
</Response>