-
Notifications
You must be signed in to change notification settings - Fork 4
GET
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).
- Overview
- Usage - Ideals: - Restrictions:
- Attributes
- Attributes (Data Specific)
- Methods (Data Specific)
- Events
- Headers - Example #1 - Example #2
- Examples - Example #1 - fig. a - (fig. b) - (fig. c)
- Other Widgets You May Find Useful:
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.
- To return bindable data to drive the the template.
- To populate populable widgets like
LISTorSELECT.
-
GETmust return valid xml or json.
| Name | Type | Default | Description | Req |
|---|---|---|---|---|
| id | string | null | The id of the widget used for databinding. | ✔ |
| url | string | null | The url the data is sent to. | ✔ |
| 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 | |
| tti | int(s,m,h) | 5s | The time the Datasources status will stay as anything but idle. |
|
| onsuccess | string | null | The string of events the broker will execute upon a successful query. | |
| onfail | string | null | The string of events the broker will execute upon a failed query. | |
| 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. |
| Name | Type | Default | Description | Req |
|---|---|---|---|---|
| data | List of item where item is a Map<String, String> or another List of item
|
If the response is encoded as valid json or xml it is deserialized and addressable using DOTNOTATION
|
||
| queueType | string | replace |
replace, lifo, fifo, append, prepend. Defines the data aggregation strategy for data returned from initial and subsequent calls. replace (default) replaces all data after each subsequent call. lifo (last in first out), fifo (first in first out), append and prepend are all used in conjunction with the maxrecords attribute |
|
| maxrecords | int | 10000 | The maximum size data can grow to. This works in concert with type
|
|
| root | string | The root tag that defines the repeatable items in data. This can be a nested field. If not specified, the list is segmented by the first repeatable element found in the data set |
||
| ttl | int(s,m,h) | 0s |
Time to Live caches data in the local persistent HIVE database for the period specified. This saves requerying data that changes infrequently |
|
| rowcount | int | 0 | The number of records in data
|
| Name | Type | Description |
|---|---|---|
| clear() | Clears data. Invoked in any EVENT string using <id>.clear() |
|
| add(jsonOrXml, index) | string, int | Deserializes the jsonOrXml string and adds it to the end of data or at position index if specified. Invoked in any EVENT string using <id>.add(jsonOrXml, index) |
| remove(index) | int | Removes the last item from data or from position index if specified. Invoked in any EVENT string using <id>.remove(index) |
| reverse() | Reverses data. Invoked in any EVENT string using <id>.reverse() |
| Name | Type | Description |
|---|---|---|
| start() | Fires the databroker. Invoked in any EVENT string using <id>.start() |
|
| stop() | Stops the databroker. Invoked in any EVENT string using <id>.stop() |
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.
This example demonstrates how to omit all headers
<HEADERS/>This example demonstrates sending a single content-type header and authorization header set to the current Json Web Token
<HEADERS>
<HEADER id="content-type" value="application/json"/>
<HEADER id="authorization" value="Bearer {SYSTEM.jwt}"/>
</HEADERS>
<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}"/>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>The data the GET is expecting.
<TEXT label="{UserData.status}"/>
<BUTTON onclick="UserData.start()" label="Fire!"/>A TEXT widget reporting the status of the GET widget, and a BUTTON calling the start() event.
Framework Markup Language is an open source programming language created by AppDaddy Software Solutions Inc. FML and is licensed under a fair source license agreement and is maintained by a community of developers.
- Quick Start
- Widget Structure
- Layout Basics
- Config
- Navigation
- Authentication
- Server Configuration
- Offline Use
- Resource Guides
-
<FML/>
- <BOX/>
- <CHART/>
- <COLUMN/>
- <DRAWER/>
- <FOOTER/>
- <FORM/>
- <GRID/>
- <HEADER/>
- <LIST/>
- <MAP/>
- <WINDOW/>
- <PAGER/>
- <ROW/>
- <SCROLLER/>
- <SPLITVIEW/>
- <STACK/>
- <TABLE/>
- <TABVIEW/>
- <TREEVIEW/>
- <WEBVIEW/>

Important Concepts