•  
      request #34743 Search a tracker by item_name
    Infos
    #34743
    Grégory OLIVER (oliver.gregory)
    2024-01-15 10:49
    2023-10-17 09:20
    36337
    Details
    Search a tracker by item_name

    I would like to search a tracker on a project exactly matching by item name but : /api/projects/352/trackers?qiuery={"item_name": "rel"} is not working

    How can i search a tracker by it's name without knowing because I need to find it's id.

    API
    15.0
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Nicolas Terray (nterray)
    Waiting for information
    Empty
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar

    By the way, to better understand your business case, and to see if we didn't miss something elsewhere, how do you end up searching a tracker by its name? Where does this name come from?

    I share the same need: while working on CLI tools to let users interact with the API, using textual values (instead of raw numeric id) is easier for a user:

    • in an interactive session (a user has a need and request the API) it is easier to remember the name or label than the numeric id
    • in a script, using names or label helps to have a self explanatory script (of course, it is possible to add comments with names/labels, but it is even better if we do not have to use comments)

    IMHO, having the ability to express the searched the items by names or labels could be really useful. Without this feature, an API client have to download all result and filter itself. On the other way, filtering directly on the server side can use the ability of the database, reducing resources usage.

    Furthermore, as names should be unique, I suggest to allow using them in API endpoints, in the place of /api/XXX/{id}. As an example, GitLab offers such feature. But this is probably a huge work.

    User avatar

    How can I be sure to get all trackers ?

    You need to query again using pagination until you reach x-pagination-size. For more details about pagination, please see https://docs.tuleap.org/user-guide/integration/rest/collections.html

    I only need to get information about one tracker

    I understand that.

    By the way, to better understand your business case, and to see if we didn't miss something elsewhere, how do you end up searching a tracker by its name? Where does this name come from?

    User avatar

    Hello, No, because /api/projects/352/trackers is limited to 50 elements max.
    How can I be sure to get all trackers ? And in fact, for best performance, I only need to get information about one tracker, not all tracker.

    User avatar

    Hello,

    This is not possible. You have to retrieve them all and search for your tracker in the retrieved collection on client side.

    Does it answer your question?


    • Status changed from New to Waiting for information
    • Assigned to changed from None to Nicolas Terray (nterray)