Use this action to issue a Web Service query.
The query is called from the server and will not be visible to the survey participant. It may be used to obtain information that is freely available on the Internet that you can then reference in your survey.
Depending on the success of the call, you may choose to run one or more scripts to handle the response and store any data returned by the web service within the survey. You can interrogate the information returned in AskiaScript by parsing the XML or using JSON to interpret the response.
For example, you could use this action to convert a monetary amount given in a foreign currency into dollars or euros by querying a webpage providing current market rates for international currencies. If the web page you are querying returns a whole table of currencies and exchange rates, you could then use askiascript to parse this information and find the specific exchange rate you require before applying this as a conversion factor to the value given by the survey participant, so that your survey data contains only dollar or euro amounts, as you choose.
Click the above image to enlarge the view.
The following options should be specified:
By default, the request method for your query is GET. You may replace by selecting an alternative method from the drop-down menu. The following HTTP and WebDAV compliant methods are offered:
GET
POST
PUT
PATCH
DELETE
COPY
HEAD
OPTIONS
LINK
UNLINK
PURGE
LOCK
UNLOCK
PROPFIND
VIEW
Enter the URL for the web resource you wish to query, complete with any parameters, qualifiers or query strings that the remote service may support or require.
[to be described]
[to be described]
Choose between:
Set with body response orAdvancedThese are described below.
Set with body response
Two text fields are provided for you to provide two alternative AskiaScripts to handle the response:
Script on success: specify a script here to extract and store data in your survey when the web service call was successful (i.e. it did not result in an error). Script on error: you may optionally specify a script here to handle the situation when your web service call returned an error.There are several askiascript commands and keywords that have been created or adapted to assist in interpreting data returned from web service queries. Principal among these are:
CurrentHttpResponse - A global object that contains the response of a query web service routing. It offers the following properties and methods:
MethodResult object properties:
True when the operation succeed, otherwise it return False and chance is to have an ErrorMessage which indicates the reason of failure.DK when the Success is True, or when there is no error code provided by the API that throw the exception.Success is True, but will normally contain a value when FalseNew Variant basic type methods:
Array Object methods:
Dictionary object properties and methods: