Skip to main content

Http

Library of HTTP functions.

Functions

Delete

Creates an HTTP DELETE location.

Syntax:
Http.Delete(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Delete(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Get

Creates an HTTP GET location.

Syntax:
Http.Get(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Get(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Creates an HTTP HEAD location.

Syntax:
Http.Head(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Head(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Options

Creates an HTTP OPTIONS location.

Syntax:
Http.Options(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Options(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Patch

Creates an HTTP PATCH location.

Syntax:
Http.Patch(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Patch(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Post

Creates an HTTP POST location.

Syntax:
Http.Post(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Post(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Put

Creates an HTTP PUT location.

Syntax:
Http.Put(url: string, bodyString: optional string, bodyBinary: optional binary, token: optional string, authCredentialName: optional string, clientId: optional string, clientSecret: optional string, authProvider: optional string, tokenUrl: optional string, useBasicAuth: optional bool, username: optional string, password: optional string, args: optional list, headers: optional list, expectedStatus: optional list)
Parameters
  • url: The HTTP URL.

  • bodyString: The string data to send as the body of the request. Cannot be used with bodyBinary.

  • bodyBinary: The data to send as the body of the request. Cannot be used with bodyString.

  • token: The bearer token to be passed as the Authorization header of the request.

  • authCredentialName: The name of the HTTP credential registered in the credentials storage.

  • clientId: The client ID to use for the client credentials OAuth flow. Requires clientSecret and tokenUrl.

  • clientSecret: The client secret to use for the client credentials OAuth flow. Requires clientId and either authProvider or tokenUrl.

  • authProvider: The provider for client ID client secret OAuth flow. Requires clientId and clientSecret.

  • tokenUrl: The URL to be used for the client credentials OAuth flow. Requires clientId and clientSecret.

  • useBasicAuth: If true, uses basic auth for the client credentials OAuth flow. Requires clientId, clientSecret and tokenUrl.

  • username: The username to be used for basic authentication. Requires password.

  • password: The password to be used for basic authentication. Requires username.

  • args: The query parameters arguments for the HTTP request. Parameters are URL-encoded automatically.

  • headers: The HTTP headers to include in the request.

  • expectedStatus: The list of expected statuses.

Returns
  • location: A location to read from.
Example:
Http.Put(
"https://www.somewhere.com/something",
headers = [{ "Content-Type", "application/json"}],
bodyString = Json.Print({name: "john", age: 35})
)

Read

Makes an HTTP call

Syntax:
Http.Read(location: location, expectedStatus: list)
Parameters
  • location: The HTTP location.

  • expectedStatus: The list of expected HTTP status codes. If the response status code received is not on the list, the call fails with an error.

Returns
  • record(status: int, data: binary, headers: list(record(_1: string, _2: string)))): The HTTP response.
Example:
let
request = Http.Read(
Http.Post(
"http://localhost:1234/return-body",
bodyString = "Hello World",
username = "user",
password = "passwd"
)
)
in
String.Decode(request.data, "utf-8")"

UrlDecode

Decodes a URL-encoded string.

Syntax:
Http.UrlDecode(value: string)
Parameters
  • value: The string to decode.
Returns
  • string: The decoded string.

UrlEncode

Encodes a string as a URL.

Syntax:
Http.UrlEncode(value: string)
Parameters
  • value: The string to encode.
Returns
  • string: The encoded string.