I have an API built in Python that outputs data and takes in the input parameter 'ID', and outputs a set of fields. The parameter does not allow bulk values to be passed and to work around this, I have tried to create a loop to make one call per Id. Below is an example of what I tried:
ID = '19727795,19485344'
#15341668,
fields = 'userID, agentID, internalID'
#add all necessary headers
header_param = {'Authorization': 'bearer ' + accessToken,'content-Type': 'application/x-www-form-urlencoded','Accept': 'application/json, text/javascript, */*'}
for x in ID:
response = requests.get(Baseuri + '/services/v17.0/agents/' + x + '?fields=' + fields , headers = header_param)
Even this loop returns an error '404 Invalid ID'
What is the way to pass a list of args into the ID parameter? I have to run this code at least once a day and need a way to pass multiple values in.
IDis a string, and iterating over a string just returns the individual characters. Either doID = ['first_id', 'second_id', ...]or dofor x in ID.split(',')