Render API Examples

The Render API is perfect if you want to download a nicely formatted and dynamic PDF image of an entire dashboard. The Render API is an add-on feature in Periscope. Here is the official documentation on the Render API. 

This post will include specific examples on how to make a request to the API using Python's Requests Library, Restlet Client, Postman, and the Curl Command. 

In order to use this API you'll need: 

- Your site name
- Your site's API-key
- Your Dashboard ID

Python Requests

Replace Dashboard ID, Aggregation, Filters, dashboard_ts, site_name, and api_key with appropriate information. 

import requests
import json

payload = {
  "data": {"dashboard_id": 12345,
  "aggregation": "daily",
  "filters": [{"name": "Filter1", "value": "Value1"}],
  "dashboard_ts": 1543437845}
}

parameters_json= json.dumps(payload)

headers = {'Content-Type': 'application/json',
          'HTTP-X-PARTNER-AUTH':'site_name:api_key'}

r= requests.post("https://api.periscopedata.com/api/v1/screenshot_requests", data=parameters_json, headers=headers)
print(r.text)

Note:  'Content-Type': 'application/json' must be included in the header. On other occasions, requests.post() automatically includes this header but adding only 'HTTP-X-PARTNER-AUTH':'site_name:api_key' , will overwrite it so both must be included. 

Restlet Client

- Select POST as method
- Enter API URL: https://api.periscopedata.com/api/v1/screenshot_requests
- Include both headers: 'Content-Type': 'application/json',  and  'HTTP-X-PARTNER-AUTH':'site_name:api_key'   (Insert own site name and api key) 
- Add the Json (use double quotes " ") 
 

 Click Send and the URL will be generated at the bottom under Response. 

Postman

- Select Post as Action
- Enter API URL: https://api.periscopedata.com/api/v1/screenshot_requests
- Include both headers: 'Content-Type': 'application/json',  and  'HTTP-X-PARTNER-AUTH':'site_name:api_key'   (Insert own site name and api key) 
- Add the Json (use double quotes " ") 

 Click Send and the URL will be generated at the bottom under Response. 

Curl Command (command line) 

Replace the Bolded words with your Site Name and API Key and Dashboard ID

curl https://api.periscopedata.com/api/v1/screenshot_requests -H "Content-Type: application/json" -H "HTTP-X-PARTNER-AUTH:site_name:api_key" --request POST --data '{"data":{"dashboard_id":12345}}'

Errors Codes

403 - Sharing dashboards has been disabled under Preferences in Periscope. This disables access to both the Embed and Render API

429 - The API requests limit has been reached for your site. Periscope allows 60 API requests per minute and 500 requests every 24 hours. Accounts may have different limits based on contract terms. 

400 - Bad Request. Revise request and try again. 

500 - Server could not interpret the Request. Double check details in the fields and try again. Otherwise contact support in chat or email at support@periscopedata.com

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like2 Follow
  • 2 Likes
  • 2 wk agoLast active
  • 45Views
  • 1 Following