HTTP Software Management
This page contains all the available HTTP software management functions in Engee.
|
To work with HTTP software management functions in Engee, follow the instructions given in article. |
#
Main.EngeeDeviceManager.Devices.HTTP.close_session — Method
function close_session(device::HttpType)::Nothing
Deinitialisation of a previously created HTTP client.
Arguments
-
device::HttpType: an object of type HTTP.Http().
#
Main.EngeeDeviceManager.Devices.HTTP.delete — Function
function delete(device::HttpType, endpoint::String, request_data::HTTPRequestData, headers::Dict{String, String}=Dict(), timeout::Union{Int64, Nothing}=nothing)::HTTPResponse
A DELETE request to the REST API. Returns a HTTPResponse — an object containing the server’s response, comprising:
-
text_content: the HTTP response in text format; -
bytes_content: the HTTP response in byte format; -
elapsed: the request execution time; -
status_code: the HTTP request status code.
Example of a server response
Base.@kwdef struct HTTPResponse
text_content::Union{String, Nothing} = nothing
bytes_content::Union{Vector{UInt8}, Nothing} = nothing
elapsed::Union{HTTPTimedelta, Nothing} = nothing
status_code::Union{Int64, Nothing} = nothing
end
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
endpoint::String: the endpoint for accessing the HTTP resource. -
request_data::HTTPRequestData: request data (an object of type HTTPRequestData). -
headers::Dict{String, String}: additional headers. For example, configuring connection headers and MIME types for requests:
julia-repl headers = Dict{String, String}() headers["connection"] = "keep-alive" headers["Accept"] = "application/json"
-
timeout::Union{Int64, Nothing}: timeout for waiting for a response, in seconds.
#
Main.EngeeDeviceManager.Devices.HTTP.get — Function
function get(device::HttpType, endpoint::String, request_data::HTTPRequestData, headers::Dict{String, String}=Dict(), timeout::Union{Int64, Nothing}=nothing)::HTTPResponse
REST API GET request. Returns a HTTPResponse — an object containing the server’s response, comprising:
-
text_content: HTTP response in text format; -
bytes_content: HTTP response in byte format; -
elapsed: request execution time; -
status_code: HTTP request status code.
Example of a server response
Base.@kwdef struct HTTPResponse
text_content::Union{String, Nothing} = nothing
bytes_content::Union{Vector{UInt8}, Nothing} = nothing
elapsed::Union{HTTPTimedelta, Nothing} = nothing
status_code::Union{Int64, Nothing} = nothing
end
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
endpoint::String: the endpoint for accessing the HTTP resource. -
request_data::HTTPRequestData: an object of type HTTPRequestData. -
headers::Dict{String, String}: additional headers. For example, configuring connection headers and MIME types for requests:
julia-repl headers = Dict{String, String}() headers["connection"] = "keep-alive" headers["Accept"] = "application/json"
-
timeout::Union{Int64, Nothing}: timeout for waiting for a response, in seconds.
#
Main.EngeeDeviceManager.Devices.HTTP.init_session — Function
function init_session(device::HttpType, base_url::String="", auth::Union{Tuple{String}, String, Nothing}=nothing, auth_type::String="bearer", headers::Dict{String, String}=Dict(), timeout::Int64=30, verify_ssl::Bool=true)::Bool
Initialising an HTTP client to communicate with an HTTP server.
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
base_url::String: the base URL for all requests. -
auth::Union{Tuple{String}: authorisation credentials, either a tuple (username, password) or a string containing a token. -
auth_type::String: authentication type (basic,digest, orbearer). -
headers::Dict{String, String}: by default, headers to include in every request. -
timeout::Int64: by default, response timeout in seconds. -
verify_ssl::Bool: SSL certificate verification (true-- enabled,false— disabled).
#
Main.EngeeDeviceManager.Devices.HTTP.patch — Function
function patch(device::HttpType, endpoint::String, request_data::HTTPRequestData, headers::Dict{String, String}=Dict(), timeout::Union{Int64, Nothing}=nothing)::HTTPResponse
REST API PATCH request. Returns HTTPResponse-- an object containing the server’s response, comprising: `
-
`text_content: HTTP response in text representation;
`
-
`bytes_content: HTTP response in byte representation;
`
-
`elapsed: request execution time;
`
-
`status_code: HTTP request status code.
Example of a server response
Base.@kwdef struct HTTPResponse
text_content::Union{String, Nothing} = nothing
bytes_content::Union{Vector{UInt8}, Nothing} = nothing
elapsed::Union{HTTPTimedelta, Nothing} = nothing
status_code::Union{Int64, Nothing} = nothing
end
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
endpoint::String: the endpoint for accessing the HTTP resource. -
request_data::HTTPRequestData: an object of type HTTPRequestData. -
headers::Dict{String, String}: additional headers. For example, configuring connection headers and MIME types for requests:
julia-repl headers = Dict{String, String}() headers["connection"] = "keep-alive" headers["Accept"] = "application/json"
-
timeout::Union{Int64, Nothing}: timeout for waiting for a response, in seconds.
#
Main.EngeeDeviceManager.Devices.HTTP.post — Function
function post(device::HttpType, endpoint::String, request_data::HTTPRequestData, headers::Dict{String, String}=Dict(), timeout::Union{Int64, Nothing}=nothing)::HTTPResponse
REST API POST request. Returns HTTPResponse — an object containing the server’s response, comprising:
-
text_content: the HTTP response in text format; -
bytes_content: the HTTP response in byte format; -
elapsed: the request execution time; -
status_code: the HTTP request status code.
Example of a server response
Base.@kwdef struct HTTPResponse
text_content::Union{String, Nothing} = nothing
bytes_content::Union{Vector{UInt8}, Nothing} = nothing
elapsed::Union{HTTPTimedelta, Nothing} = nothing
status_code::Union{Int64, Nothing} = nothing
end
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
endpoint::String: the endpoint for accessing the HTTP resource. -
request_data::HTTPRequestData: an object of type HTTPRequestData. -
headers::Dict{String, String}: additional headers. For example, configuring connection headers and MIME types for requests:
julia-repl headers = Dict{String, String}() headers["connection"] = "keep-alive" headers["Accept"] = "application/json"
-
timeout::Union{Int64, Nothing}: response wait timeout in seconds.
#
Main.EngeeDeviceManager.Devices.HTTP.put — Function
function put(device::HttpType, endpoint::String, request_data::HTTPRequestData, headers::Dict{String, String}=Dict(), timeout::Union{Int64, Nothing}=nothing)::HTTPResponse
PUT request to the REST API. Returns HTTPResponse — an object containing the server’s response, comprising:
-
text_content: HTTP response in text representation; -
bytes_content: HTTP response in byte representation; -
elapsed: request execution time; -
status_code: HTTP request status code.
Example of a server response
Base.@kwdef struct HTTPResponse
text_content::Union{String, Nothing} = nothing
bytes_content::Union{Vector{UInt8}, Nothing} = nothing
elapsed::Union{HTTPTimedelta, Nothing} = nothing
status_code::Union{Int64, Nothing} = nothing
end
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
endpoint::String: endpoint for accessing the HTTP resource. -
request_data::HTTPRequestData: an object of type HTTPRequestData. -
headers::Dict{String, String}: additional headers. For example, configuring connection headers and MIME types for requests:
julia-repl headers = Dict{String, String}() headers["connection"] = "keep-alive" headers["Accept"] = "application/json"
-
timeout::Union{Int64, Nothing}: timeout for waiting for a response, in seconds.
#
Main.EngeeDeviceManager.Devices.HTTP.remove_header — Method
function remove_header(device::HttpType, key::String)::Nothing
A function to remove the specified request headers from the existing headers.
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
key::String: the key of the request header to be set.
#
Main.EngeeDeviceManager.Devices.HTTP.set_header — Method
function set_header(device::HttpType, key::String, value::String)::Nothing
A function for setting request headers alongside existing ones.
Arguments
-
device::HttpType: an object of type HTTP.Http(). -
key::String: the key of the request header to be set.