FLX app provide a HTTP API that provides the common HTTP methods as functions. The implementation is based on Fuel library.
HTTP API Functions

Cancels the given request
.
request
– aCancellableRequest
Returns: true
if the request was actually cancelled, otherwise false
.

Executes a HTTP DELETE request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.
Returns: a CancellableRequest

Executes a HTTP DELETE request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous. Parameters are given as a Map
which defines one or more key -> value pairs.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.parameters
– aMap
containing key-value pairs
Returns: a CancellableRequest

Executes a HTTP GET request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.
Returns: a CancellableRequest

Executes a HTTP GET request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous. Parameters are given as a Map
which defines one or more key -> value pairs.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.parameters
– aMap
containing key-value pairs
Returns: a CancellableRequest

Executes a HTTP POST request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.
Returns: a CancellableRequest

Executes a HTTP POST request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous. Parameters are given as a Map
which defines one or more key -> value pairs.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.parameters
– aMap
containing key-value pairs
Returns: a CancellableRequest

Executes a HTTP PUT request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.
Returns: a CancellableRequest

Executes a HTTP PUT request with the given url
. A callback
function with signature (result:HttpResult)
is required since the request is asynchronous. Parameters are given as a Map
which defines one or more key -> value pairs.
url
– aString
specifying a valid URLcallback
– aFunctionObject
, e.g. an anonymous function (see Functions with single parameter of typeHttpResult
.parameters
– aMap
containing key-value pairs
Returns: a CancellableRequest

Returns the value of the given httpResult
as a String
.
- *
httpResult*
– aHttpResult
Returns: a String

Gets the JSON value from the given httpResult
object. See the JSON API page.
httpResult
– aHttpResult
object
Returns: a JsonObject
Example
Below is a simple example of making a GET request to obtain a joke from Chuck Norris Jokes API.

- The Jokes API path.
- Creating the URL. Function str concatenates all its arg values to a String. (One could of course just define that url is “https://api.chucknorris…”)
- Invoke the GET function with the url and a callback.
- A Callback object has a handler code defined in a code block.
- A Callback can have also optional arguments. In this case there is single parameter for passing the HttpResult object, which is received asynchronously as a GET function response, to the Callback object. The code block implementing the calback handler is shown below.

- The response parameter of Callback object. In this example the value of the parameter is of type HttpResult.
- The JSON value payload is obtained from the received HttpResult object.
- The actual joke property value is obtained from the response JSON using property key "value".
- The joke value is converted to a String and printed.