HTTP Commands

HTTP Commands

All SaveToDB products support URLs in the Actions Menu and Context Menu.

All SaveToDB add-in versions support using URLs to get data.

SaveToDB 10 supports URLs and complex HTTP commands everywhere.
You can get data using POST, save data changes, get value lists, etc.

URL Parameters

This topic shows how to define URL parameters.

For example, a URL contains a symbol as a segment:

https://some-service/APPL

You can place the parameter name and the default value in curly brackets:

https://some-service/{Symbol=APPL}

This sample has a standard URL parameter, "s":

https://some-service?s=APPL

The SaveToDB add-in will place it to the ribbon.

You can change the parameter name and specify the default value using curly brackets:

https://some-service?s={Symbol=APPL}

If you need to disable parameters at all, add {} at the end of the URL.

https://some-service?s=APPL{}

Parser Parameters

The SaveToDB add-in automatically extracts data from JSON, XML, HTML, CSV, and plain text.

You can tune parser results applying special parser parameters.

Add parser parameters after the URL. Separate parameters by a semicolon. Separate parameter values by comma.

For example:

https://query1.finance.yahoo.com/v7/finance/options/{Symbol=AAPL};pages=50;rootpath=*.*.*.calls,*.*.*.puts

https://www.zohoapis.com/crm/v2/settings/fields?module={module=Accounts};RootPath=fields;ApiResult=true

Supported Parser Parameters

ParameterTypeMeaning
AddRowNumBooleanAdd a _RowNum column.
ApiResultBooleanUse a special JSON parser for REST API results.
AsIsBooleanOutput Yahoo Finance and MSN Money JSON values as is.
CapitalLetterBooleanCapitalize header first letters (JSON only).
CollapsedNodesStringInclude specified XML nodes into the parent node column.
FirstRowIntegerSet the first row of the source data to output.
FirstRowHasNamesBooleanHint parsers that the source data has headers or not.
IgnoredTagsStringDo not create columns for the specified XML tags.
InputSeparatorStringSet the CSV input separator.
KeptNodesStringAdd the specified XML or JSON nodes to the output even if the column has no data.
PagesIntegerSet the number of pages to load.
RootPathStringSet XML nodes, JSON properties, or HTML table numbers to select data.
SkippedNodesStringExclude XML nodes or JSON properties with specified paths from the output.

HTTP Headers

SaveToDB 10 allows setting request headers inline.

Add HTTP headers separated by single CR, LF, or CRLF after the URL line. Separate header names and values by a colon.

For example:

https://some-service/{Symbol}
Accept: application/json
Referrer: https://some-service/page

You can use parameters defined in curly brackets in headers also (for example, to customize the referrer).

HTTP methods

SaveToDB 10 supports HTTP methods: GET, POST, PUT, PATCH, MERGE and DELETE.

You can use these methods when specifying REST API commands to save changes.

Add a method before the URL, separated by space.

Message Body

SaveToDB 10 supports application/json and application/x-www-form-urlencoded body formats.

It detects it automatically using the body definition.

The body can contain parameters prefixed with the @ character.

You can specify parameters for all properties manually.

Also, you can use built-in parameters @json_row_values and @form_row_values that include all row values.

Separate the body from the URL and headers by two line breaks.

Here is an example of the POST command:

POST https://www.zohoapis.com/crm/v2/Contacts

{"data":[{@json_row_values}]}

See details at Saving Data Using REST API.

Select Queries from HTTP Requests

SaveToDB 10 supports select queries from HTTP requests.

For example, you can use the following form to add a symbol parameter value to output columns:

SELECT @Symbol, * FROM https://some-service/{Symbol=APPL}

However, we recommend using the full form with the column aliases for parameters and square brackets for URLs and HTTP messages like

SELECT @Symbol AS Symbol, * FROM [https://some-service/{Symbol=APPL}]

You can specify the required column names to select and assign new column names using aliases. For example:

SELECT @Symbol AS Symbol, d AS Date, l AS Last FROM [https://some-service/{Symbol=APPL}]

Moreover, you can use multi-line queries, including WHERE and ORDER BY clauses.

SELECT
    @Symbol AS Symbol
    , d AS Date
    , l AS Last
FROM
    [https://some-service/{Symbol=APPL}]
ORDER BY
    Date

Below is a more complex example:

SELECT
    @Symbol AS Symbol
    , d AS Date
    , l AS Last
FROM
    [POST https://some-service/;ApiResult=true HTTP/1.1
Accept: application/json
Referrer: https://some-service/page

{"symbol":@symbol}
]
ORDER BY
    Date

Formal Grammar of HTTP Commands

HTTP-command = HTTP-message | select

HTTP-message = [ method SP ] request-target [ SP HTTP-version] *( NEWLINE header-name ":" header-value ) [ 2*NEWLINE message-body ]

method = "GET" | "POST" | "PUT" | "PATCH" | "MERGE" | "DELETE"

request-target = absolute-URI *( ";" parser-parameter-name "=" parser-parameter-value )

HTTP-version = "HTTP/1.1"

select = "SELECT" SP select-fields SP "FROM" SP select-source [SP "WHERE" conditions ] [ SP "ORDER BY" orderBy ]

select-source = "[" HTTP-message "]" / DQUOTE HTTP-message DQUOTE

NEWLINE = CR | LF | CRLF

This grammar extends RFC standards: