I am trying to run an API with multiple id's and I am normalizing the json file and trying it to put into a dataframe. With my current code I am able to get only one response into jsonfile2. When I try to print the json response I will get all the response but response.json() is not working in my code.
for id in ids:
time.sleep(1)
url = "https:url/../details/"+str(id)
querystring = {"API-Token":"Token"}
headers = {
'cache-control': "no-cache",
'postman-token': "111111111111111111111"
}
response = requests.request("GET", url.format(id=ids), headers=headers, params=querystring)
# print(response.json())
jsonfile2 = response.json()
works_data2 = json_normalize(jsonfile2, record_path='result')
Example of JSON response
{
"result": {
"id": "string",
"startTime": 0,
"endTime": 0,
"tags": [
{
"context": "context",
}
],
"Events": [
{
"startTime": 0,
"endTime": 0,
"entityId": "string",
"status": "CLOSED",
"severities": [
{
"context": "context",
"value": 0,
"unit": "Bit (bit)"
}
]
}
}