Divooka Reference

REST Sources

2 nodes

On this page 2

Query CSV API

Function

A table from a web API that answers in CSV: the query is sent to the address on every run, and the answer is read as Read CSV reads a file - the delimiter told from the text unless one is given, each column's kind inferred. When the address cannot be reached the run stops with "Dataset not reachable" and says why; a refused query says what the server said.

Signature
QueryCsvApi -> Table
    URL: Text
    query: Text Array
    headers: Text Array
    method: Request Method
    body: Text
    delimiter: Text
    header: Truth
    skipRows: Integer
    timeout: Number
Table QueryCsvApi(
    string url,
    string[] query,
    string[] headers,
    RequestMethod method = RequestMethod.GET,
    string body = "",
    string delimiter = "auto",
    bool header = true,
    int skipRows = 0,
    double timeout = 30)

Parameters

nametypedefaultdescription
URLText—The API's address, http or https.
queryText Array—Query parameters added to the address, one "name=value" each; the node encodes them. ${NAME} reads the environment variable NAME.
headersText Array—Headers sent with the query, one "Name: value" each - "Authorization: Bearer ${API_TOKEN}" keeps a token out of the document. A value is never written into a message.
methodRequest MethodGETGET asks for data; POST sends Body with the query.
bodyText—What a POST sends: JSON goes as application/json, anything else as plain text, unless Headers say otherwise. A GET sends nothing.
delimiterTextautoWhat separates the cells: "auto" to tell from the answer, or a comma, semicolon, "tab" or bar.
headerTruthTrueWhether the first row holds the column names.
skipRowsInteger0How many lines to pass over first - notes the API writes above the table.
timeoutNumber30How many seconds to wait for the whole answer.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
REST Sources
Package
Data Analytics

Query JSON API

Function

A table from a web API that answers in JSON: the query is sent to the address on every run, and the rows are read from where Rows Path leads - an array of records, a column per field, or an array of arrays, its cells named by Columns in order. Columns picks the fields to keep, nested ones as "properties.mag", and renames one as "properties.mag as Magnitude". Each column's kind is inferred as a CSV file's is, so numbers sent as strings are numbers. When the address cannot be reached the run stops with "Dataset not reachable" and says why; a refused query says what the server said.

Signature
QueryJsonApi -> Table
    URL: Text
    query: Text Array
    headers: Text Array
    method: Request Method
    body: Text
    rowsPath: Text
    columns: Text Array
    timeout: Number
Table QueryJsonApi(
    string url,
    string[] query,
    string[] headers,
    RequestMethod method = RequestMethod.GET,
    string body = "",
    string rowsPath = "",
    string[] columns,
    double timeout = 30)

Parameters

nametypedefaultdescription
URLText—The API's address, http or https.
queryText Array—Query parameters added to the address, one "name=value" each; the node encodes them. ${NAME} reads the environment variable NAME.
headersText Array—Headers sent with the query, one "Name: value" each - "Authorization: Bearer ${API_TOKEN}" keeps a token out of the document. A value is never written into a message.
methodRequest MethodGETGET asks for data; POST sends Body with the query.
bodyText—What a POST sends: JSON goes as application/json, anything else as plain text, unless Headers say otherwise. A GET sends nothing.
rowsPathText—Where the rows are in the answer: "features", "data.items", "results[0].rows", or "$" for the answer itself. Empty finds them as Read JSON does: the answer itself, or the one list of records in it.
columnsText Array—The columns to keep, in order: a field of each record ("name", nested "address.city", "coordinates[0]"), renamed with "as" ("properties.mag as Magnitude"); for rows that are arrays, the cells' names in order. Empty keeps every field.
timeoutNumber30How many seconds to wait for the whole answer.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
REST Sources
Package
Data Analytics