REST Sources
2 nodes
On this page 2
Query CSV API
FunctionA 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.
QueryCsvApi -> Table
URL: Text
query: Text Array
headers: Text Array
method: Request Method
body: Text
delimiter: Text
header: Truth
skipRows: Integer
timeout: NumberTable 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
| name | type | default | description |
|---|---|---|---|
| URL | Text | — | The API's address, http or https. |
| query | Text Array | — | Query parameters added to the address, one "name=value" each; the node encodes them. ${NAME} reads the environment variable NAME. |
| headers | Text 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. |
| method | Request Method | GET | GET asks for data; POST sends Body with the query. |
| body | Text | — | What a POST sends: JSON goes as application/json, anything else as plain text, unless Headers say otherwise. A GET sends nothing. |
| delimiter | Text | auto | What separates the cells: "auto" to tell from the answer, or a comma, semicolon, "tab" or bar. |
| header | Truth | True | Whether the first row holds the column names. |
| skipRows | Integer | 0 | How many lines to pass over first - notes the API writes above the table. |
| timeout | Number | 30 | How many seconds to wait for the whole answer. |
Returns
| Table | Table |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- REST Sources
- Package
- Data Analytics
Query JSON API
FunctionA 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.
QueryJsonApi -> Table
URL: Text
query: Text Array
headers: Text Array
method: Request Method
body: Text
rowsPath: Text
columns: Text Array
timeout: NumberTable QueryJsonApi(
string url,
string[] query,
string[] headers,
RequestMethod method = RequestMethod.GET,
string body = "",
string rowsPath = "",
string[] columns,
double timeout = 30)Parameters
| name | type | default | description |
|---|---|---|---|
| URL | Text | — | The API's address, http or https. |
| query | Text Array | — | Query parameters added to the address, one "name=value" each; the node encodes them. ${NAME} reads the environment variable NAME. |
| headers | Text 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. |
| method | Request Method | GET | GET asks for data; POST sends Body with the query. |
| body | Text | — | What a POST sends: JSON goes as application/json, anything else as plain text, unless Headers say otherwise. A GET sends nothing. |
| rowsPath | Text | — | 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. |
| columns | Text 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. |
| timeout | Number | 30 | How many seconds to wait for the whole answer. |
Returns
| Table | Table |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- REST Sources
- Package
- Data Analytics