Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compressed ids in filters on API #11636

Closed
Fryguy opened this issue Oct 1, 2016 · 1 comment
Closed

Support compressed ids in filters on API #11636

Fryguy opened this issue Oct 1, 2016 · 1 comment
Assignees

Comments

@Fryguy
Copy link
Member

Fryguy commented Oct 1, 2016

An example query from the manageiq-api-client, miq.vms.find("1r1"), fails.

On the server side I see

[----] I, [2016-09-30T17:42:54.499267 #770:3fc89469d6dc]  INFO -- : Started GET "/api/vms?expand=resources&filter%5B%5D=id%3D%271r1%27&limit=1" for ::1 at 2016-09-30 17:42:54 -0400
[----] I, [2016-09-30T17:42:54.527087 #770:3fc89469d6dc]  INFO -- : Processing by Api::VmsController#show as JSON
[----] I, [2016-09-30T17:42:54.527192 #770:3fc89469d6dc]  INFO -- :   Parameters: {"expand"=>"resources", "filter"=>["id='1r1'"], "limit"=>"1", "vm"=>{}}
@abellotti
Copy link
Member

Note to myself (before I forget)

While we support compressed Id's in url's and references to resources (i.e. href and id), we do not support compressed id in filtering. For id (maybe *_id) filter attributes, we should check the filter value, if compressed id, then decompress before building the MiqExpression. Most likely enhancement would go in parameters.rb file in method parse_filter.

abellotti added a commit to abellotti/manageiq that referenced this issue Jan 24, 2017
- This enhancement allows filtering on id attribute or any of the *_id
named attributes, i.e. storage_id, ems_id, etc. by compressed id,

  i.e.
    GET /api/vms?expand=resources&attributes=name,vendor&filter=id='2r77'
    GET /api/instances?expand=resources&attributes=name,storage_id&filter[]=storage_id=1r32

- Added specs

Fixes: ManageIQ#11636
terciodemelo pushed a commit to maas-ufcg/manageiq that referenced this issue Feb 1, 2017
- This enhancement allows filtering on id attribute or any of the *_id
named attributes, i.e. storage_id, ems_id, etc. by compressed id,

  i.e.
    GET /api/vms?expand=resources&attributes=name,vendor&filter=id='2r77'
    GET /api/instances?expand=resources&attributes=name,storage_id&filter[]=storage_id=1r32

- Added specs

Fixes: ManageIQ#11636
rodneyhbrown7 pushed a commit to rodneyhbrown7/manageiq that referenced this issue Mar 27, 2017
- This enhancement allows filtering on id attribute or any of the *_id
named attributes, i.e. storage_id, ems_id, etc. by compressed id,

  i.e.
    GET /api/vms?expand=resources&attributes=name,vendor&filter=id='2r77'
    GET /api/instances?expand=resources&attributes=name,storage_id&filter[]=storage_id=1r32

- Added specs

Fixes: ManageIQ#11636
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants