Query as a web service

 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. 

web-service query

Click the above image to enlarge the view.

The following options should be specified:

Request method

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

URL

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. 

Headers

[to be described]

Body

[to be described]

Response

Choose between:

These are described below.

Set with body response

Set with body response

Advanced (response)

Two text fields are provided for you to provide two alternative AskiaScripts to handle the response:

Related askiascript commands and keywords

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:

New Variant basic type methods:

Array Object methods:

Dictionary object properties and methods:

Note: The StatusCode -1 is reported when the query fails to execute properly; most often this happens when the URL you're trying to query is not reachable, e.g. due to remote server being down, DNS issue or network interruption.

 

 

 

 

 

 

 

Create your own Knowledge Base