Http - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki

Http : Datasource

Overview

The base class for all HTTP data sources. Http is an inherited class and cannot be created directly in markup.

Attributes

Name Type Default Description Req
url string null The url of the remote source / destination
autoexecute bool true If the widget will fire when the template is first opened or on url change
autoquery int(s,m,h) null If set the broker fires on a timer set by the autoquery
tti int(s,m,h) 5s The time the Datasources status will stay as anything but idle.
onsuccess string/Event null The string of events the broker will execute upon a successful query.
onfail string/Event null The string of events the broker will execute upon a failed query.
online bool true If connected to the internet, the transaction executes immediately in the foreground while the user waits for it to complete.
offline bool true If offline="true" the transaction will be written to the persistent cache and executed at a future date by the POSTMASTER service in the background. This executes immediately if connected to the internet, otherwise, it executes as soon as the device comes back into view of the web.

Methods

Name Type Description
start() Fires the datasource. Invoked in any EVENT string using <id>.start()
stop() Stops the datasource. Invoked in any EVENT string using <id>.stop()
clear() Clears the datasource. Invoked in any EVENT string using <id>.clear()

Properties

Name Type Default Description Req
rowcount int 0 The number of records in the data bindable
status string idle The status of the broker, returns error, success or idle.
statusmessage string null Returns a status message (usually from the response on an exception ).
statuscode string null Returns the http status code.
httpstatus string null Returns the generic message associated with the http status code.

Headers

The default HTTP headers for POST, PUT, GET and DELETE are as follows:

  • age = '0';
  • content-encoding= 'utf8';
  • content-type = "application/xml";
  • authorization = JWT TOKEN

If the <HEADERS> element is specified, the defaults headers are omitted and replaced with those specified.

Example #1

This example demonstrates how to omit all headers

<HEADER/>
Example #2

This example demonstrates sending a single content-type header and authorization header set to the current Json Web Token

logo See it in Action

<HEADER key="content-type" value="application/json"/>
<HEADER key="authorization" value="Bearer {SYSTEM.jwt}"/>

Other Widgets You May Find Useful:

⚠️ **GitHub.com Fallback** ⚠️