JSON Data source
JSON Data source provides a quick and flexible way to issue queries to arbitrary RESTful endpoints that return JSON data.
Create the JSON Data source
Navigate to Integrations > Data Sources
Click New Data Source
Select JSON
Create the data source
Enter a name for your data source (required)
Enter Basic Authentication credentials (optional)

Writing queries
Navigate to Queries and click New Query
In the drop-down on your left hand side, select your new data source
Providing HTTP Options
The following HTTP options are used for sending a query
url
- This is the URL where the RESTful API is exposedmethod
- the HTTP method to use (default:get
)headers
- a dictionary of headers to send with the requestauth
- basic auth username/password (should be passed as an array:[username, password]
)params
- a dictionary of query string parameters to add to the URLdata
- a dictionary of values to use as the request bodyjson
- same asdata
except that it’s being converted to JSONpath
- accessing attributes within the responsefield
- rows of objects within selected attribute
Example query:
url: https://www.googleapis.com/books/v1/volumes?q=isbn:0747532699
path: items
fields: ["volumeInfo.authors","volumeInfo.title","volumeInfo.publisher","accessInfo.webReaderLink"]

Example query including all HTTP options:
url: https://httpbin.org/post
method: post
headers: {"User-Agent": "Test", "Accept": "*/*"}
auth: [username, password]
params: {?q=myQuery}
json: {"this": "is", "my": {"json":"body"}}
path: json
fields: ["my.json"]
Filtering response data: path and fields
The response data can be filtered by specifying the path
and fields
parameters. The path
filter allows accessing attributes within the response, for e.g. if a key foo
in the response contains rows of objects you want to access, specifying path
foo
will convert each of the objects into rows.
In the example below, we are then selecting fields
volumeInfo.authors, volumeInfo.title, volumeInfo.publisher and accessInfo.webReaderLink
url: https://www.googleapis.com/books/v1/volumes?q=isbn:0747532699
path: items
fields: ["volumeInfo.authors","volumeInfo.title","volumeInfo.publisher","accessInfo.webReaderLink"]
The resulting data from the above query is a nicely formatted table that can be searched in Apica Ascent or made available as a widget in a dashboard

Last updated
Was this helpful?