TABLE OF CONTENTS
If your App needs to call out to external systems to retrieve or send data, then you have to configure an External Data Source., so that your App is able to send requests to its API. Because CafeX manages the external APIs for you, you do not have to write code to authenticate, maintain, and establish the connection. Your App needs a Data Set to interact with the External Data Source. This article describes both of these features.
The External Data Source allows you to configure several aspects of a RESTful API. Before you configure an External Data Source, you have to be familiar with RESTful services.
To create a new External Data Source:
- Go to Configure > External data sources.
- Select any of the External Data Sources.
- Click Edit data source ().
- Under Configuration, is a JSON definition for the endpoint that your App uses to access the API.
- Schema, there is a JSON definition of information your App uses.
When you configure an External Data Source, you can use Extract Schema to have CafeX call the endpoint and parse the data object. The response schema provides the App Studio with a definition of response objects that your App references.
Example Data Source configuration
The following API definition provides you with information about a domain name registrations
Operation | URL |
---|---|
GET | https://api.domainsdb.info/v1/domains/search URL Parameters: domain Example URL: https://api.domainsdb.info/v1/domains/search?domain=cafex.com |
Example Response:
{ |
The following Configuration is all that this Data Source requires.
Data Source configuration can include the following attributes:
Attribute | Description |
---|---|
URL | The URL of the endpoint. Use %VARIABLE% to parameterize URL fields. |
method | The Request method to use: Typically, RESTful services use requests for the following: POST non-idempotent—creates new objects PUT idempotent—updates objects GET idempotent (no change)—retrieves data |
urlparameter | An array of URL parameters |
auth | The Request uses authentication headers, an OAUTH2 token |
payload | Defines JSON payloads for POST and PUT requests |
As this is a GET request, use Extract Schema to test the endpoint and automatically generate the schema for your App to use:
Adding a Data Set for an External Data Source
To perform operations on an External Data Source, you have to collect parameters and use them to evaluate a Data Set in your App. The Data Set provide your Apps with a consistent way to interact with data.
For a guide that uses Components, Data Sets, and External Data Sources, see: Enhancing your App
To add a Data Set to search on:
- In App Studio, go to Explorer > App.
- On the Appearance and Configuration panel, click Configuration.
- Click Add Data set.
- Complete the form and select the appropriate Data Source.
- Click Add
Your Components in your App can make use of the Data Set.
If your Data Set requires inputs, because your Data Source has URL parameters, you have to associate a new Form Component with the Data Set before you set the field on the original Data Set.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article