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

<GET/> : Http

The GET datasource widget is used to retrieve bindable data from an API endpoint using a standard HTTP GET method. The widget is executed by using the id.start event where is the id of the GET widget and/or by setting autoexecute to true. If autoexecute="true", the widget fires automatically when the TEMPLATE is first opened. Data returned from the call can be bound using the standard Dot Notation binding syntax. GET widgets can have multiple TRANSFORM widgets to selectively transform data which is returned from the call. Response can be returned as JSON or XML (default).

Table of Contents

Usage

The GET widget is used to return a data package to be used and bound to within the FRAMEWORK. Curly braces {} are used to denote bindable fields that return a value.

Ideals:

  • To return bindable data to drive the the template.
  • To populate populable widgets like LIST or SELECT.

Restrictions:

  • GET must return valid xml or json.

Attributes

Name Type Default Description Req
autoexecute bool true If the widget will fire when the template is first opened or on url change
autoquery int(s,m,h) 0s If set the broker fires on a timer set by the autoquery
refresh boolean false If set to true, a UUID is appended to the query string on each and every call forcing the browser to requery rather than retrieving the file from cache
rowcount int n/a The number of records in the data bindable

Examples

Example #1
<GET id="UserData" url="api/users/" autoexecute="true" tti="25s" ttl="5m" root="USER"/>

<TEXT label="{UserData.data.username}"/>
<TEXT label="{UserData.data.age}"/>
<TEXT label="{UserData.data.gender}"/>
fig. a

A GET with text bound to the data packet fields(#figb).

<USERS>
	<USER>
		<username>TheOlajos</username>
		<age>27</age>
		<gender>Male</gender>
		<occupation>Wizard</occupation>
	</USER>
</USERS>
(fig. b)

The data the GET is expecting.

<TEXT label="{UserData.status}"/>
<BUTTON onclick="UserData.start()" label="Fire!"/>
(fig. c)

A TEXT widget reporting the status of the GET widget, and a BUTTON calling the start() event.

logo See it in Action

Other Widgets You May Find Useful:

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