I'm trying to use requests to pass a number of conditions to the Connectwise REST api. I'm trying to generate a URL like below
/company/configurations/?pageSize=1000&conditions=id=83500 and type/name="Printer" and name="TEST API PRINTER"
but I only seem to be able to generate this:
/company/configurations/?pageSize=1000&conditions=id&conditions=type/name&conditions=name
My payload looks like this:
parameters = {}
parameters['conditions'] = {}
parameters['pageSize'] = 1000
if db_rid:
parameters['conditions']['id'] = 83500
if type_name:
parameters['conditions']['type/name'] = "Printer"
if name:
parameters['conditions']['name'] = "TEST API PRINTER"
requests.get(APIurl, params=parameters)
Where am I going wrong?
id=83500 and type/name="Printer" and name="TEST API PRINTER". It's not some sort of magic nested parameters. You just need to set theconditionsparameter equal to that string.parameters['conditions'] = 'id=83500 and ...'