Report
A Report
is an object that allows the user to create and cutomize PDF reports of data collected in Scans
.
Tips
Reports are intended for single use. i.e. one Report
services one Page
and is thus updated when new Scan
data is present.
Report object
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482", // uuid specific to Report
"page":"46053956-761b-4ca6-8cec-3be796695d12", // uuid specific to Page
"time_created":"2021-11-19T19:33:33.912725Z", // timestamp of Report creation
"user":"example@gmail.com", // user denoted by email
"type": [ // array of data categories to report on (one or both of "lighthouse", "yellowlab")
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0", // remote path to s3 storage location
"info":{ // object containing color options for generating the report
"text_color":"#24262d", // hex color of text in report
"highlight_color":"#4283f8", // hex color of highlights & accents in report
"background_color":"#e1effd", // hex color of background in report
}
}
Create or Update Report
There are two usecases for this endpoint, Creating and Updating Reports
.
POST - /report
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{CURSION_API_BASE_URL}/report'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
data = {
"report_id": None, # Insert <report:id> if updating report
"background_color": "#e1effd",
"highlight_color": "#fffff",
"text_color": "#24262d",
"page_id": "<page:id>",
"type": ["yellowlab", "lighthouse"],
}
# send the request
res = requests.post(
url=url,
headers=headers,
data=json.dumps(data)
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482",
"page":"46053956-761b-4ca6-8cec-3be796695d12",
"time_created":"2021-11-19T19:33:33.912725Z",
"user":"example@gmail.com",
"type": [
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0",
"info":{
"text_color":"#24262d",
"highlight_color":"#4283f8",
"background_color":"#e1effd",
}
}
Retrieve a Report
This endpoint returns a single Report
object and is useful as a simple "detailed view" of the report.
GET - /report/<report:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/report/<report:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482",
"page":"46053956-761b-4ca6-8cec-3be796695d12",
"time_created":"2021-11-19T19:33:33.912725Z",
"user":"example@gmail.com",
"type": [
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0",
"info":{
"text_color":"#24262d",
"highlight_color":"#4283f8",
"background_color":"#e1effd",
}
}
Retrieve many Reports
This endpoint returns a paginated response with all Report
objects filtered by your account and ordered by time_created
. This endpoint is useful when needing to displaying your reports in a table view for example. The limit
parameter specifies the total number of objects you want returned per "group" (we recommend keeping this under 10 for best performance). The offset
parameter specfies which "group" to return. For example, limit=10&offset=10
in a total dataset of 30 objects would return 10 reports in range report #10 - report #20.
GET - /report?limit=10&offset=0
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/report?limit=10&offset=0'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"count":30,
"next":"https://api.cursion.dev/v1/ops/report?limit=10&offset=20",
"previous":"https://api.cursion.dev/v1/ops/report?limit=10&offset=10",
"results":[
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482",
"page":"46053956-761b-4ca6-8cec-3be796695d12",
"time_created":"2021-11-19T19:33:33.912725Z",
"user":"example@gmail.com",
"type": [
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0",
"info":{
"text_color":"#24262d",
"highlight_color":"#4283f8",
"background_color":"#e1effd",
}
},
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482",
"page":"46053956-761b-4ca6-8cec-3be796695d12",
"time_created":"2021-11-19T19:33:33.912725Z",
"user":"example@gmail.com",
"type": [
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0",
"info":{
"text_color":"#24262d",
"highlight_color":"#4283f8",
"background_color":"#e1effd",
}
},
{
"id":"aa6f5ba7-e83a-4ce0-a790-9a6706ed1482",
"page":"46053956-761b-4ca6-8cec-3be796695d12",
"time_created":"2021-11-19T19:33:33.912725Z",
"user":"example@gmail.com",
"type": [
"lighthouse",
"yellowlab"
],
"path":"https://cursion.sfo3.digitaloceanspaces.com/static/sites/aa6f5ba7-e83a-4ce0-a790-9a6706ed1482/8c233a26-6ea5-4ba6-b5a5-c15a2eafe983.pdf#toolbar=0",
"info":{
"text_color":"#24262d",
"highlight_color":"#4283f8",
"background_color":"#e1effd",
}
},
### SHORTENED FOR DISPLAY PURPOSES ###
]
}
Delete a Report
Caution
Please use caution with this endpoint as it is irreversible.
DELETE - /report/<report:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/report/<report:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.delete(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"message": "report deleted successfully"
}