# Package lynx

# Functions

# apiCall

Perform an authenticated call to the API using the gateways credentials. Returning the response as a LUA object.

# Parameters

Name Optional Description
Method No HTTP Method to use
Path No Path of the URL to request
Body Yes Include a body in the request
IoTCfg Yes Config to load parameters and authentication from

# Example

local res = lynx.apiCall("POST", "/api/v2/functionx/1", {
    type = "test",
    meta = {key1 = "val1"}
})

# apiCallRaw

Perform a GET request to the API using the gateways or provided credentials. The result is returned as a string if success or error object.

# Parameters

Name Optional Description
Path No Path in the Lynx API to use
IoTCfg Yes Config to load parameters and authentication from

# Example

local resRaw = lynx.apiCallRaw("/api/vw/functionx/1")

# getFunctions

Fetch a list of functionx objects for the installation using the API.

See API Specification

# Parameters

Name Optional Description
Filter Yes Metadata or type used to filter the functions

# Example

local functions = lynx.getFunctions({
    key1 = "value1",
    key2 = "value2"
})

# getApps

Performs an API-request and fetches all configured for the current installation.

See API Specification

# Example

local apps = lynx.getApps()

# downloadApp

Performs a file download using the API to fetch the executable code for an app. The app is returned as a text string.

See API Specification

# Parameters

Name Optional Description
App-ID Yes ID of the app to download
Version Yes Version of the app to download

# Example

local appCode = lynx.downloadApp(1, "0.3.5")