REST Overview
Configuring the REST data provider
To use the REST data provider in Jigx , follow these high-level steps:
Choose your datasource
Identify the REST API you will use as your datasource. Ensure you understand its endpoint structure, request requirements (like headers and query parameters), and the format of the data it returns.
Define a REST Service in a Jigx function in Jigx Builder
Navigate to the functions folder in Jigx Builder.
Use IntelliSense to configure the REST data provider.
Enter the base URL, method, parameters of the REST API.
Configure REST Authentication:
If the API requires authentication (such as OAuth, API keys, etc.), configure these settings. This might involve adding headers, query parameters, or setting up OAuth tokens.
Define data methods in the function:
Set up different methods your application can perform using this API, such as GET, POST, PUT, DELETE, etc.
For each method, create a new function to specify the endpoint, required headers, URL parameters, input and output transforms, continuation, and body content if applicable.
Configure properties to handle API limits, errors and file storage.
In the function configure the REST provider to cater for errors, such as 403, 404 or 500.
Convert images and files from local-uri to an acceptable storage format, such as base64 or buffer.
Add Continuation if the REST services limit the number of items to be returned. Jigx REST calls can automatically repeat calls by specifying a continuation block.
Bind data to the UI by referencing the local data and functions in jigs
Use the data from the local database in datasources in jigs and components components to build the required UI.
Reference the function in your jigs in actions. This step is crucial for integrating the API data seamlessly into your Jigx solution.
Publish your solution:
Publish your solution and use the app to interact with the REST data provider.
Test the Data Provider:
Use Jigx Builder developer tools to test the data provider configurations. Check if the data provider can connect to the API successfully and perform operations like GET (fetch), PUT (create), POST (update), or DELETE data.
Following these steps, you can effectively integrate external REST APIs into your Jigx solutions, allowing you to enhance your apps with data and functionalities from diverse external sources.
See Also
Last updated
Was this helpful?