Call URL block
The block Call URL
can be used to call a URL, e.g. from an API.
On the Settings pane of the Block, you can configure following properties:
- URL to call
- Method to use (GET, POST, PUT...)
- Timeout in seconds: maximum time to wait for a response
- Params: optionally add one or more parameters. When Method GET is used, these parameters are added to the querystring, otherwise they are added to the POST body
- Headers: optionally add one or more headers
If you want to set a raw post body, click on the gear icon next to Params, and select Raw
. You will now be able to set your POST body:
Basic Auth
You can use a Custom code block to implement Basic Auth. This authentication requires you to calculate the base64 encoded string of login:password
. The result must be added as header Authorization
with value "Basic <base64_encoded_string>". Example using PHP:
Example code:
echo json_encode(base64_encode("login:password));
Note that the response of the custom code block must always be json encoded, which is why echo json_encode()
is used around the actual base64 encoding. Below is the header. Make sure to have a space between Basic
and the base64 encoded string (output of custom code block):
Accessing API's for which Qlik Application Automation for OEM does not have a connector (yet)
If you would like to access a REST API or SOAP Webservice, and Qlik Application Automation for OEM does not have a connector for that platform, please reach out to us (support@blendr.io). We typically add new connectors within 2 weeks, at a fixed cost.
If you can't wait, you can use the above block to make your own calls, or you can use the Custom code block to execute a script that will call the API.
Make sure to check out Postman, a great tool to test API calls.
If none of the above solve your problem or you need a Private Connector
(e.g. to a custom non-public API), you can contact Qlik Application Automation for OEM and request a quote for Professional Services.
Accessing SOAP Webservices
SOAP Webservices can be a bit of a challenge. WSDL-Analyzer is a great tool that will convert the WSDL file of a SOAP Webservice to actual SOAP messages (the XML body of your HTTPS POST). Click here for a simple SOAP request example. Finally, Postman has a blog article on how to call SOAP Webservices.
Here's a simple example of calling a SOAP Webservice using the Block Call URL
:
Example Params:
<s11:Envelope
xmins:s11='http://schemas.xmlsoap.org/soap/envelope/'>
<s11:Body>
<ns1:intA>4</ns1:intA>
<ns1:intB>2</ns1:intB>
</ns1:Add>
</s11:Body>
</s11:Envelope>
The response is XML and needs to be converted to JSON in order to use it further on in the automation. We use the Custom code block for this (contact Qlik Application Automation for OEM support if this block is not activated in your account):
Here's the PHP custom code to convert XML to JSON:
$xml = preg_replace("/<(\/)?[a-zA-Z0-9]+:/", "<$1", $inputs); //remove namespace in XML
$jsonString = json_encode(simplexml_load_string($xml));
echo $jsonString; //output of the custom script should be a JSON encoded string
Warning: this example code may have different results, depending on if there are one or multiple tags of the same kind in an XML. See the article Processing XML for more information!
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!