Populating a ViewBox from a REST API
The ViewBox control can be populated from a REST API data source by setting the Datasource type to "REST API". Use this option to make a REST API call to retrieve the JSON data to be rendered in the ViewBox.
When you use the REST API option, you can specify if the REST call is made from the server or from the client.
When you make the call from the server, the Alpha Anywhere server will make the REST API call and then return the JSON data to the browser. If you later refresh the ViewBox, an Ajax callback is made to the server, the server executes the REST API call and then returns the JSON data to the client.
When you make the call from the server, you can specify a URL for the REST API end point that includes placeholders that will get resolved before the call is made. You can use controls on the UX and also arguments as placeholders. For example, say you have a textbox on your UX called customerId. You might specify the URL for the REST API as:
When the API call is made, the placeholders in the URL are resolved. So, for example, if at the time the ViewBox is refreshed, the customerId control has a value of CUST_01, the URL for API call will be:
Argument values are represented in the URL using :argument_name. For example, assume you have an Argument called CUSTOMER_ID. You could specify this URL for the API endpoint:
In some cases, the API endpoint you call will be authenticated. For example, many API endpoints require an oAuth authentication or a "service account" login. You can specify the name of a Named Provider (defined by going to the Tools menu when the Web Control Panel has focus, and selecting Tools, Named Providers, or by opening the Project Properties dialog).