Forum Discussion
iControl REST $filter processing not HTTP compliant?
I'm trying to get objects over iControl REST using python "requests". The expected method would be something like:
r = requests.session()
r.get('https://tmhost/mgmt/tm/ltm/node', params={'$filter': 'name eq NODENAME'})This fails, because requests - complying with the HTTP spec - encodes the "$" in the URL as %24, which fails; the LTM responds with:
HTTP/1.1 400 Bad Request
{"code":400,"message":"Query parameter %24filter is invalid.","errorStack":[]}If I manually send the HTTP request using netcat, without escaping the $, this works OK.
Is there any way to use $filter with an HTTP-compliant library?
6 Replies
- Brad_Parker
Cirrus
I think you will need to pass the params as a string, though its not pretty. i.e.
r.get('https://tmhost/mgmt/tm/ltm/node', params='$filter=name eq NODENAME')- nonenonenone123
Nimbostratus
That is indeed really unpleasant. Do you know if this is a known limitation, bug, or similar? - Brad_Parker
Cirrus
Its not a bug, its the design of the iControl REST api. I don't know that there is a plan to allow URL encoding or not. Many frameworks are more than happy to not use URL encoding for REST.
- Brad_Parker_139
Nacreous
I think you will need to pass the params as a string, though its not pretty. i.e.
r.get('https://tmhost/mgmt/tm/ltm/node', params='$filter=name eq NODENAME')- nonenonenone123
Nimbostratus
That is indeed really unpleasant. Do you know if this is a known limitation, bug, or similar? - Brad_Parker_139
Nacreous
Its not a bug, its the design of the iControl REST api. I don't know that there is a plan to allow URL encoding or not. Many frameworks are more than happy to not use URL encoding for REST.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com