Hello,
I have tetsed a simple way to get data from the API with Python.
I'm working under Windows 10, with Anaconda, Python 3.9.7
This is quick and dirty code I have validated after validating the settings of the server with a colleague of mine.
Cheers
import requests
import pandas as pd
SERVER="your.server.here"
URL=f"http://{SERVER}/api"
MY_AUTH = ('user', 'password')
def GetData(req):
# Returns a dictionnary structure form the request "req"
return requests.get(f"{URL}/{req}", auth = MY_AUTH).json()
def GetDataPd(req):
# Converts into a panda DataFrame
return pd.DataFrame.from_dict(GetData(req))
if __name__ == '__main__':
# Get the list of projects and print the names and parent's name of non closed projects
projs = GetDataPd("Project/all")
print(projs[projs != 'closed']
'name', 'nameProject')