Product

 View Only
Expand all | Collapse all

Create filters using the REST API

  • 1.  Create filters using the REST API

    Posted 07-31-2019 09:12
    Hi,

    Currently in our system we have a lot of external filtering on items obtained in JAMA. My only issue now is that after I filter the items, how do I get it back into JAMA?

    I have currently been GET on a JAMA filter, pulling all of the items in that filter, filtering them out externally, and then I have an excel document with the filtered items. What I would like to do would be to create a filter in JAMA with the filtered items instead of resorting to an excel document. 

    I am proposing that we can add a POST operation for filters so that we can create them using the REST API.


  • 2.  RE: Create filters using the REST API

    Posted 26 days ago
    I think this feature is a MUST and should be added as soon as possible.

    ------------------------------
    Franco Lombardini
    Monolithic Power Systems
    ------------------------------



  • 3.  RE: Create filters using the REST API

    Posted 25 days ago
    A couple of questions:
    - Why are you doing the filtering externally rather than using Jama filters?
    - When you say "get it back into Jama", do you mean "create a filter in Jama that selects exactly that list of items"?   

    If that is what you meant, then note that your are asking for a new kind of filter, namely one that selects an specific list of items (not supported today).    As a workaround, you could create a tag for that external filter, and then use the REST API to set that tag on the list of items selected by that external filter.   Then you could use a Jama filter that selects items with that tag to see the same list of items selected by your external filter.

    ------------------------------
    Geoffrey Clemm
    Jama Software
    ------------------------------



  • 4.  RE: Create filters using the REST API

    Posted 25 days ago
    Hi Geoffrey,

    In my scenario I'm trying to optimize the response time of my application which the bottleneck is the requests to the Jama API.

    I need to obtain all items that live under a certain item (let's call it item Z) but the only two options I have are either getting all Jama items and then filtering the ones living under item Z locally or getting the children recursively which takes a lot of request and therefore time.

    What I need (and it seems like the OP does too) is being able to create a filter and post it to Jama via the API filters endpoints. Then I can use that filter to get all these items through a single request.

    Thank you,
    Franco





  • 5.  RE: Create filters using the REST API

    Posted 25 days ago
    Hi Franco,

    are you looking for the ability to use a filter (or the result set of a filter) like a subprogram in another filter?

    regards
    Harald

    ------------------------------
    Harald Hotz-Behofsits
    Frequentis AG
    ------------------------------



  • 6.  RE: Create filters using the REST API

    Posted 24 days ago
    That clarifies what you are looking for.   If you submit an Ideation request on this, I'd suggest identifying this specific use case, i.e. retrieving all items that are in the tree rooted at a given item.   That is likely to be easier to implement and a more efficient way of retrieving this information than a generic "create filter" API call.

    ------------------------------
    Geoffrey Clemm
    Jama Software
    ------------------------------



  • 7.  RE: Create filters using the REST API

    Posted 24 days ago

    @Franco Lombardini I suspect you mean relationships and not location when refering to "living under" or "getting the children": You could manually save a filter which gives back all items on all levels​ which have direct or indirect upstreams to the root item you are searching for. To not having to change the filter query programatically (which is not really possible anyways) you can add a unique tag to the root item and still use the "static" filter query with the tag representing the root item. As tags are not part of the item versioning you wouldn't even alter the root item, but you need write permission on the root item though. After getting the filter results you then can remove the tag from the root item.
    If you want to provide a jama link for the filter you could generate a filter preview query with the actual root item ID instead of the tag which the user then can save for him-/herself.



    ------------------------------
    Jan Kastning
    System Engineer
    Panasonic Industrial Devices Europe GmbH
    ------------------------------



  • 8.  RE: Create filters using the REST API

    Posted 24 days ago
    Edited by Geoffrey Clemm 22 days ago
    I would normally interpret "under" or "children" to refer to the location hierarchy, and not relationships, but Franco can clarify which he meant.

    ------------------------------
    Geoffrey Clemm
    Jama Software
    ------------------------------



  • 9.  RE: Create filters using the REST API

    Posted 24 days ago
    I was indeed referring to location inside the hierarchy and not items relationship.

    I've been able to generate this filter without any issues using the GUI but the idea is not to make users define this filter for each project when it could be easily generated through code using the API.

    I'll submit the ideation request, maybe it's a better idea to add this "get items living under X" to the /items endpoint than using filters but I'm sure we'll discuss that there.

    Thanks for your help





  • 10.  RE: Create filters using the REST API

    Posted 24 days ago
    Edited by Geoffrey Clemm 24 days ago
    To be clear, I am a strong supporter of both the explicit API call to retrieve all items in the tree rooted at a particular item, as well as the ability to create filters via the API.   The reason I support both is that there is a bunch of overhead associated with creating a filter, which isn't needed if you just want to download that tree of items as quickly and efficiently as possible.

    ------------------------------
    Geoffrey Clemm
    Jama Software
    ------------------------------



  • 11.  RE: Create filters using the REST API

    Posted 24 days ago
    I agree Geoffrey, both things are clearly needed but to fix this particular problem the cleanest solution is to offer an efficient way to retrieve items from Jama based on their hierarchy, especially when this tool is often used on big projects containing a huge number of items.

    Then there're a million scenarios where filters are needed and therefore a million reasons to support that too!

    ------------------------------
    Franco Lombardini
    Monolithic Power Systems
    ------------------------------



  • 12.  RE: Create filters using the REST API

    Posted 23 days ago
    Edited by Jan Kastning 23 days ago
    @Franco Lombardini ​Ah okay, I was not aware that the GET items/{id}/children endpoint is not capable of doing that already, maybe this could be extended by an optional parameter to include all children not only the direct ones. Definetly a +1 from my side. You could still generate a filter preview url, at least you can then provide a filter view in Jama. Although, the filter still has to be saved manually.

    @Geoffrey Clemm "If so, how would such a filter be defined (i.e. what rules would you use)?": ​​I would create a filter which basically looks like this:
    • ALL ITEMTYPES having TAG = "#UNIQUETAG#" or having upstreams to item of
      • ALL ITEMTYPES having TAG = "#UNIQUETAG#" or having upstreams to item of
        => repeat as often as how many layer to be checked
        • ALL ITEMTYPES having TAG = "#UNIQUETAG#"
    Performance is pretty okay in our Jama: ~10 seconds for checking 8 layers of upstreams (maximum possible in the used project) and having ~1,000 filter results over 6 layers in my example. I added the tag to an item in the 3rd layer as I do not have write access to the two top layers.

    ------------------------------
    Jan Kastning
    System Engineer
    Panasonic Industrial Devices Europe GmbH
    ------------------------------



  • 13.  RE: Create filters using the REST API

    Posted 23 days ago
    I've generated an Ideation request for this topic, you can check it out here: Idea Details - Jama Software Community

    If you could add your thoughts in the post I would highly appreciate it!

    ------------------------------
    Franco Lombardini
    Monolithic Power Systems
    ------------------------------



  • 14.  RE: Create filters using the REST API

    Posted 23 days ago
    Edited by Geoffrey Clemm 22 days ago
    For anyone wondering how to create this kind of multiple-level nested filter, see:  < https://community.jamasoftware.com/discussion/workaround-filter-on-locationrelease-in-embedded-filters-and-have-multi-level-embedded-filters >
    As indicated in that post, you cannot use the Jama GUI to create this kind of filter.
    ------------------------------
    Geoffrey Clemm
    Jama Software
    ------------------------------



  • 15.  RE: Create filters using the REST API

    Posted 22 days ago
    The multi-level nested filters are actually another reason to add the filter POST endpoint. Then one could update the filter rules, which is not possible right now even with the workaround.
    Please reconsider adding the endpoint and adding multi-level filters, especially since the Jama backend already can do that.

    ------------------------------
    Jan Kastning
    System Engineer
    Panasonic Industrial Devices Europe GmbH
    ------------------------------