Sep-28-2021, 07:37 AM
(This post was last modified: Sep-28-2021, 11:09 AM by Yoriz.
Edit Reason: Added code tags
)
In the below script, I'm pulling data from level opportunity api, take contact from opportunity and pass it to level contact api and get all the fields related to that contact. After print(contacts_url), I'm getting 50 urls with contact ids, but after print(content_load) at the end , I'm getting only 1 contact data.
How to pass all the contacts in the list to contact api url and get all the contacts data?
How to pass all the contacts in the list to contact api url and get all the contacts data?
import requests import json r_o = requests.get('https://api.lever.co/v1/opportunities', auth=('I47euT', '')) ob = json.loads(r_o.text) for i in range(len(ob["data"])): lst = [] lst.append(ob["data"][i]['contact']) contacts_url='https://api.lever.co/v1/contacts/' contacts_url=contacts_url+ob["data"][i]['contact'] print(contacts_url) r_contact = requests.get(contacts_url, auth=('I47euT', '')) ob = json.loads(r_contact.text) content_load = ob['data'] print(content_load)