REST Datasource
The REST Datasource is a base component of UDG to help you add existing REST APIs to your data graph. By attaching a REST datasource to a field the engine will use the REST resource for resolving.
We have a video which demoes this functionality for you.
Using external REST API as a Datasource
In order to use an external REST API as a Datasource you need to first navigate to the field which that Datasource should be attached to.
- Click on the field which should have a datasource attached
- From the right-hand side Configure data source panel choose REST at the bottom in the Add a new external data source section
- Provide data source name, URL, method to be used. Optionally you can add headers information and configure field mapping
- Click SAVE button to persist the configuration and generate a REST resolver, which will resolve this field at runtime.
Using Tyk REST API as a Datasource
- Click on the field which should have a datasource attached
- From the right-hand side Configure data source panel choose REST | Tyk dropdown to see all available APIs
- Choose which Tyk REST API you want to attach
- Provide data source name, endpoint and method to be used. Optionally you can add headers information and configure field mapping
- Click SAVE button to persist the configuration and generate a REST resolver, which will resolve this field at runtime.
Once done the field you just configured will show information about data source type and name: