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

API - way to query for specific item #7

Open
hudecsamuel opened this issue Apr 13, 2016 · 2 comments
Open

API - way to query for specific item #7

hudecsamuel opened this issue Apr 13, 2016 · 2 comments

Comments

@hudecsamuel
Copy link

Problem:
I wanted to find element with specific name inside project (ex. MAX_CPC)

Current Solution:
Get all elements inside a project - /projects/:id/elements/?limit=300 *
*Setting high limit is to ensure we get all elements inside a project
Then we can filter through array of elements and find the one matching our parameter

<?php
$elementName = "MAX_CPC";
$element = null;

foreach($elements as $el) {
    if($el->name == $elementName) {
        $element = $el;
        break;
    }
}

The same problem arises when we try to find id of ♥ALLPRODUCTS query. (this might not be valid since it's related to #6 )

This is just an idea: I propose is to be able to query API for specific attribute value ("element_name": "MAX_CPC").
There probably are more possible implementations for this, if it should be implemented.

@smuuf smuuf added the API label Apr 13, 2016
@paveldedik
Copy link
Contributor

More advanced queries like "return element by its name" are planned in future. At the moment I recommend iterating through all elements using limit and offset (setting high limit isn't garanteed to return all elements).

@hudecsamuel
Copy link
Author

That's great! I'm pleased to hear that. And yeah, iterating through all of them is the current solution I adopted.

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

3 participants