Skip to main content

Web Query Custom Response Parsers

A Web Query Dataset sends a request to a Web Datasource and turns the response into rows. When the response is not already a flat array of records, choose Custom Script as the response parser and write JavaScript that shapes it (see Creating a Web Query Dataset).

A custom response parser runs once for every response, with these available:

NameWhat it does
responseThe response being processed: its data, status, headers, and the config of the request that produced it.
push()Adds records to the Dataset. An array adds one record per element; anything else adds a single record.
next()Schedules another request from a request config, such as the next page of results.
isFirstResponse()Returns true only while the parser handles the response to the first request.
$localAn object that keeps its values from one response to the next.
_ and momentThe same lodash 3 and Moment.js libraries as other Informer scripts.

In this section​

ArticleIn one line
Using the next() functionSend a follow-up request from the parser, the building block for the rest of this section.
Handling Pagination in Web QueriesKeep requesting pages until the API says there are no more.
Automating Token Retrieval in Web QueriesRequest a short-lived access token, then use it in the data request.
Unioning Two Informer Datasets Using a Web Query and the Informer REST APICombine several Datasets into one by reading them through Informer's own API.