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

Make "tag" an available field to search for components in query_string #2920

Closed
hugomcfonseca opened this issue Feb 23, 2018 · 10 comments
Closed
Labels
Feature Good First Issue If you're looking for a good issue to PR, start here
Milestone

Comments

@hugomcfonseca
Copy link

Current API does not support to query for components using tags as a querystring field.

Is it expectable to have this implemented? I can help with a pull request.

@nalysius
Copy link
Contributor

Hello,

The idea of querying for components using tags may be useful. But the question that I am wondering is: a component may have many tags, so in the query string we may give many tags too. Should they be combined with an AND and OR? And if an OR, should he be exclusive or not?

Example:

http://cachet.dev/api/v1/components?tags[]=tag1&tags[]=tag2

Are we looking for components that have tag1 && tag2, or those that have tag1 || tag2?

@hugomcfonseca
Copy link
Author

@anthonybocci I would vote in option A because to be consistent with current API. For example, if you get info from http://cachet.dev/api/v1/components?status=1&name=XYZ, it would return an AND operation, not an OR.

@nalysius
Copy link
Contributor

@hugomcfonseca I agree, indeed the other criterias are an AND operation, so the components that are returned in your example have the status 1 && the name XYZ.

So it would be something like:

http://cachet.dev/api/v1/components?tags[]=ABC&tags[]=DEF&name=XYZ
The returned component(s) will have the name XYZ && the both tags ABC && DEF.

@hugomcfonseca
Copy link
Author

Yes, exactly @anthonybocci.

@nalysius
Copy link
Contributor

@hugomcfonseca if you implement it I can contribute if necessary, either by coding or testing.

@hugomcfonseca
Copy link
Author

hugomcfonseca commented Feb 27, 2018

ok @anthonybocci, I am already on it. Once I finish it, I'll do a pull request

@nalysius
Copy link
Contributor

👍
It could be great if the documentation was updated automatically. Otherwise nobody will be able to use the updated API.

@hugomcfonseca
Copy link
Author

I created an issue related to that a few days ago (issue #2903), but still without any feedback at the moment.

@jbrooksuk jbrooksuk added Feature Good First Issue If you're looking for a good issue to PR, start here labels Mar 15, 2018
@jbrooksuk jbrooksuk added this to the V2.4.0 milestone Mar 15, 2018
@jbrooksuk
Copy link
Member

Since tags can technically be applied to any model now, I'd be keen on having this built into Cachet :)

@jbrooksuk
Copy link
Member

I started working on this last night for a "proof of concept", I don't think it's too much work honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Good First Issue If you're looking for a good issue to PR, start here
Projects
None yet
Development

No branches or pull requests

3 participants