REST API Endpoints
Connect charts to any REST API and extract data with JMESPath.
REST API Endpoints
Connect your charts to any REST API that returns JSON. ChartPuppy fetches the data on demand or on a schedule and uses JMESPath to extract the relevant portion.
Quick Start
- Go to the Data page and click New Data Source
- Select REST API as the source type
- Choose the HTTP method (GET or POST) and enter the endpoint URL
- Add a JMESPath expression to extract the data array from the response
-
Add any required headers (e.g.
Authorization: Bearer <token>) - Click Create Source
- In the chart editor, switch to the Connect tab and select your API source from the dropdown
JMESPath Data Path
The data path field accepts any valid JMESPath expression. JMESPath is a query language for JSON that lets you extract, filter, sort, and reshape data from API responses.
Simple Paths
If your API returns:
{"results": {"items": [{"name": "A", "value": 10}, ...]}}
Use: results.items
Filtering
Select only items matching a condition:
data[?status == 'active']
observations[?value != '.']
Sorting
Sort results by a field:
sort_by(data, &date)
Slicing
Get the last 10 items:
data[-10:]
Combining
Expressions can be chained with the pipe operator:
observations[?value != '.'] | sort_by(@, &date) | [-5:]
This filters out placeholder values, sorts by date, and takes the last 5 entries.
Projections
Select specific fields from each item:
data[*].{label: name, amount: total}
HTTP Method
Choose GET (default) or POST from the dropdown next to the URL field. Use POST when the API requires it — for example, GraphQL endpoints or APIs that accept query parameters in the request body.
Headers
Add authentication or other headers in the headers field, one per line:
Authorization: Bearer sk-abc123
Accept: application/json
Auto Refresh
After connecting an API, configure automatic refresh:
- Every 15 min to Every 24 hours refresh intervals
- Auto-export on refresh generates a new image each time the data updates
Troubleshooting
| Issue | Solution |
|---|---|
| “Data path returned no results” | Check that your JMESPath expression matches the response structure. Try a simpler path first (e.g. just the top-level key). |
| “Invalid data path” | Your JMESPath expression has a syntax error. Check brackets, quotes, and operators. |
| “Expected data to be an array” | The path must resolve to an array of objects. Wrap single objects in an array or adjust the path. |
| “Requests to private addresses not allowed” | ChartPuppy blocks requests to localhost and private IPs for security. Use a public URL. |
| HTTP 401/403 |
Add the correct Authorization header. |