Skip to content

HTTP Client Service

Enable your West Connectivity solution to make HTTP requests.

This service allows Event Handlers in West Connectivity to make HTTP requests to external servers. You can use this post device data to an existing business system, integrate with a 3rd party web application, or many more use cases.

Operations

Http

Configuration parameters

Please note that bold arguments are required, while italic arguments are optional.

Name Type Description
credentials string(password) Credentials (key/pair to be replaced in http headers/body/url) e.g.

Operations

Please note that bold arguments are required, while italic arguments are optional.

delete

Make a http DELETE request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.delete({url = "https://example.com/user/1"})

print(res.status_code)

get

Make a http GET request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.get({url = "https://www.google.com"})

print(res.status_code)

Make a http HEAD request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.head({url = "https://example.com/user/1"})

print(res.status_code)

options

Make a http OPTIONS request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.options({url = "https://example.com/user/1"})

print(res.status_code)

patch

Make a http PATCH request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.patch({url = "https://www.google.com", body="xyz"})

print(res.status_code)

post

Make a http POST request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.post({url = "https://www.google.com", body="xyz"})

print(res.status_code)

put

Make a http PUT request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.put({url = "https://www.google.com", body="xyz"})

print(res.status_code)

request

Make a http request

Arguments

parameters (object) - Object containing service call parameters.

Name Type Description
url string Url to make the request against.
body string The raw data to be transmitted. If this is used along with a GET request, the payload will be ignored.
json object Json data to be transmitted, this will set content-type to 'application/json'.
method string Http method for the request
Default: "get"
params object Field-value pairs data, this will be encoded as query string in URL when method is GET, otherwise encoded as name-value pairs in body, in this case content-type will be set as 'application/x-www-form-urlencoded'.
headers object Additional headers to provide in the request.
headers.*** string Header value
credentials string Credentials
conn_timeout integer Timeout to establish a connection, in milliseconds, default 3000, maximum 10000
recv_timeout integer Timeout used when receiving a connection, in milliseconds, default 5000, maximum 20000

Responses

Code Body Type Description
200 object Request results retrieved
400 nil Required parameters are not provided
422 nil Provided parameters are not valid

Object Parameter of 200 response:

Name Type Description
body string The body of response
headers object The headers of response
status_code integer The status code of response

Example

local res = Http.request({url = "https://www.google.com"})

print(res.status_code)

Service Health Check

Operations

/

Enable the hosting system to check if service is active and running

Arguments

No Content

Responses

Name Type Description
200 string OK

Errors

No content