Using The API¶
You can access every object generated by Prevision Platform from the API .
To run the Code below you need your Master Token. It is available in the API Key page of your user settings :
You can use the native urllib module to parse API. This page show how to use API with raw python but we suggest to use the SDK ( Python and R ) for an higher level of abstraction.
First, import native python 3 urllib.request and set up your Token ( warning : if you have an on promise server or custom dedicated domain, you need to replace the url “cloud.prevision.io” with your own )
1import urllib.request
2import pandas as pd
3import ssl
4import json
5
6MASTER_TOKEN="<YOUR_MASTER_TOKEN>"
7
8BASE_PATH ="https://cloud.prevision.io/ext/v1"
9
10projectsurl = f"{BASE_PATH}/projects"
11request = urllib.request.Request(projectsurl)
12request.add_header('Authorization',MASTER_TOKEN )
13# Disable SSL check
14projectslist = urllib.request.urlopen(request, context=ssl.SSLContext()).read()
15projectslist = json.loads(projectslist)