I finally made it!
What is unfortunate is that it generates a file and does not send the data directly in response to the requests.
But opening it afterwards, no problem.
I'm posting the solution in case it helps someone someday:
headers = {
'Accept': 'application/json',
'X-ZAP-API-Key': apiKey
}
'title' : 'reportTitle',
'template' : 'traditional-json',
'sites' : target,
'reportFileName' : 'jsonreport'
}, headers = headers)
#Response = {'generate': '/home/user/jsonreport.json'}
generateFile = generateFile.json()
jsonreportPath = generateFile['generate']
#Open file and save json data into vulnResult
with open(jsonreportPath) as json_file:
vulnResult = json.load(json_file)
return vulnResult
Thank you very much again!