<< Click to Display Table of Contents >> Raynet One > 1.1 > User Guide > Technical overview > API Use case: export data with REST API |
The accumulated and enriched data by Raynet One is valuable. For custom report creation purposes, the data can be exported into file formats, design documents of your own choice. Information can be selected by custom criteria, taking parametrization by the management into account to create even more targeted displays than the ones presented in the web interface. Create specific data analysis interfaces for your customers with access to a limited data set based on an access rights system of your own design.
•Python 3+
•Requests library (https://docs.python-requests.org/en/latest/)
•API key
•frontend URL
import requests
APIKEY = "PUT API KEY HERE"
FRONTEND = "PUT FRONTEND URL HERE"
HEADERS = { "ApiKey": APIKEY }
def obtain_paged(EP):
P = {}
P["count"] = 1000
items = []
while True:
result = requests.get(EP, params=P, headers=HEADERS)
if result.ok == False:
break
objs = result.json()
if objs == None:
return
if len(objs) == 0:
return
items.extend(objs)
lastobj = objs[len(objs)-1]
P["LastId"] = lastobj["id"]
return items
def main():
OS = obtain_paged(FRONTEND + "/api/v1/OperatingSystems")
if OS == None:
print( "request failed from the frontend (" + FRONTEND + ")" )
return
print(str(OS))
F = open("./output", "w")
F.write(str(OS))
F.close()