Accessing Reports results via API
This page describes how to access report results via API
Once the report is created, its results can be accessed via APIs.
get
/api/queries/:queryid
Get Query By Id
Once the results id is extracted invoke the results API to get the results
get
/api/query_results/:result_id
Get Results by result_id

Python Example

1
import requests
2
import json
3
4
5
uri_query = 'https://logs.logiq.ai/api/queries/<query_id>'
6
uri_result = 'https://logs.logiq.ai/api/query_results/'
7
8
def post_query():
9
# Add api key to header
10
headers = {'Authorization': 'Key see_below_to_get_api_key'}
11
# GET Query API to get latest_query_data_id
12
r = requests.get(uri_query, headers=headers, verify=False)
13
r.raise_for_status()
14
# From the queries API extract the latest report id
15
latest_report_id = r.json()['latest_query_data_id']
16
# Construct the results url
17
uri_result_end = uri_result + str(latest_report_id)
18
# GET Results API
19
qr = requests.get(uri_result_end, headers=headers, verify=False)
20
qr.raise_for_status()
21
# Prints results
22
print(json.dumps(qr.json()['query_result']['data']['rows'], indent = 3))
23
24
post_query()
Copied!
Last modified 6mo ago