Skip to content

HTTP Client Service

Summary

Enable your Murano solution to make HTTP requests.

This service allows Event Handlers in Murano 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

Name Tag Summary
http.delete() Http Make a http DELETE request
http.get() Http Make a http GET request
http.head() Http Make a http HEAD request
http.options() Http Make a http OPTIONS request
http.patch() Http Make a http PATCH request
http.post() Http Make a http POST request
http.put() Http Make a http PUT request
http.request() Http Make a http request

Configuration parameters

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

Operations

delete

Description

Make a http DELETE request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

get

Description

Make a http GET request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

Description

Make a http HEAD request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

options

Description

Make a http OPTIONS request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

patch

Description

Make a http PATCH request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

post

Description

Make a http POST request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

put

Description

Make a http PUT request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

request

Description

Make a http request

Arguments

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

  • Returns {object} when Request results retrieved

    The http response to the caller {object}

    Name Type Description
    body string The body of response
    headers object The headers of response
    status_code integer The status code of response
  • Returns nil for Required parameters are not provided

  • Returns nil for Provided parameters are not valid

Example

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

print(res.status_code)

Last update: December 7, 2021
Back to top