Skip to main content

Get HTTP connection settings

Gets the settings structure for HTTP connection

Function GetHTTPConnectionSettings(Val Address, Val Authorization = Undefined, Val AdditionalHeaders = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Address--urlStringConnection address with protocol and port
Authorization--authString, Structure Of KeyAndValueAuthorization: string for JWT, structure for basic
AdditionalHeaders--headersMap Of KeyAndValueAdditional request headers
Returns

Structure Of KeyAndValue - Connection settings structure

1C:Enterprise/OneScript code example
URL = "http://localhost:8123";
// No authorization

Result = OPI_ClickHouse.GetHTTPConnectionSettings(URL);

// With basic authorization

Login = "bayselonarrend";
Password = "12we...";

Authorization = New Structure(Login, Password);

Result = OPI_ClickHouse.GetHTTPConnectionSettings(URL, Authorization);

// With JWT authorization

JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test";

Result = OPI_ClickHouse.GetHTTPConnectionSettings(URL, JWT);

// With additional headers

AdditionalHeaders = New Map;
AdditionalHeaders.Insert("X-Custom-Header", "CustomValue");

Result = OPI_ClickHouse.GetHTTPConnectionSettings(URL, Authorization, AdditionalHeaders);
# JSON data can also be passed as a path to a .json file

oint clickhouse GetHTTPConnectionSettings \
--url "http://127.0.0.1:8123" \
--auth "{'bayselonarrend':'***'}" \
--headers "{'X-Custom-Header':'CustomValue'}"
Result
{
"address": "http://host.docker.internal:8123",
"headers": {
"X-Custom-Header": "CustomValue"
},
"transport": "http",
"auth_type": "basic",
"user": "bayselonarrend",
"password": "***"
}