Http
Library of HTTP functions.
Functions
Delete
Makes an HTTP DELETE call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Get
Makes an HTTP GET call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Head
Makes an HTTP HEAD call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Options
Makes an HTTP OPTIONS call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Patch
Makes an HTTP PATCH call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Post
Makes an HTTP POST call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
Put
Makes an HTTP PUT call.
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 withbodyBinary
.
bodyBinary
: The data to send as the body of the request. Cannot be used withbodyString
.
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. RequiresclientSecret
andtokenUrl
.
clientSecret
: The client secret to use for the client credentials OAuth flow. RequiresclientId
and eitherauthProvider
ortokenUrl
.
authProvider
: The provider for client ID client secret OAuth flow. RequiresclientId
andclientSecret
.
tokenUrl
: The URL to be used for the client credentials OAuth flow. RequiresclientId
andclientSecret
.
useBasicAuth
: If true, uses basic auth for the client credentials OAuth flow. RequiresclientId
,clientSecret
andtokenUrl
.
username
: The username to be used for basic authentication. Requirespassword
.
password
: The password to be used for basic authentication. Requiresusername
.
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.
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.
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(s: string)
Parameters
s
: The list to decode.
UrlEncode
Replaces characters of a string by characters legal within a URL
Syntax:
Http.UrlEncode(s: string)
Parameters
s
: The list to encode.