POST calls that include functions must be in data, not params, but parameters such as _return_fields must be in params, not data. So this splits the kwargs into params and data, based on the fact that all params have a leading underscore.
As shown using requests directly:
# This works, and we get the objref returned:
data = {'ipv4addr':'func:nextavailableip:192.168.10.0/24',
'match_client':'RESERVED'}
r = session.post('https://infoblox/wapi/v1.4/fixedaddress', data=json.dumps(data))
print(r.content)
# But adding _return_fields causes it to fail:
data.update({'_return_fields':'ipv4addr'})
r = session.post('https://infoblox/wapi/v1.4/fixedaddress', data=json.dumps(data))
print(r.content)
# And switching to `params` doesn't work either, due to the func:nextavailableip call:
r = session.post('https://infoblox/wapi/v1.4/fixedaddress', params=data)
print(r.content)
Also, support was added to the get method for direct objref style, which returns a single object instead of a objtype list:
POST calls that include functions must be in data, not params, but parameters such as _return_fields must be in params, not data. So this splits the kwargs into params and data, based on the fact that all params have a leading underscore.
As shown using
requests
directly:Also, support was added to the get method for direct objref style, which returns a single object instead of a objtype list: