Expand all | Collapse all

REST API /abstractitems contains field

  • 1.  REST API /abstractitems contains field

    Posted 02-06-2018 11:02
    Edited by Victor LastName 02-06-2018 11:06


    I'm having trouble understanding the syntax of the "contains" field in the /abstractitems REST API endpoint.

    How can I search for all the items which have, for example, "abc xyz" contained somewhere in the name field?

    Basically, the results should include items with the following name field values:

    • "abc xyz"
    • "sdfjlkdsfabc xyzdsjflkdsjflds"
    • "one twoabc xyz"
    • "abc xyzthree four"
    And not include items with the following name field values:
    • "abc"
    • "xyz"
    • "abc xy"
    • "abc sdflkdsf xyz"
    • "abcgxyz"
    • "xyz abc"

    In my experiements, when I enter "name:abc xyz" in the contains field, I will get a lot of unexpected results; returning items that I don't know how they got matched (items that don't even have either "abc" nor "xyz" in their names are being returned).

    When I enter "name:abc" in the contains field, the results are only items with name field values that contain "abc" somewhere within it.  Which is good, this is what I expect.

    So, it seems the space character in "abc xyz" is somehow a factor and not being taken literally.

    I have also tried putting extra quotations around the search value like "name:"abc xyz"" in the contains field, however this will do an exact match of the "abc xyz" by itself in the name field.  It will return an item with the following name:
    • "one two abc xyz three four"

    However, it will not return an item with a name like:

    • "asdfdabc xyzdsfldsf"

    What is the correct syntax for matching on a literal set of words (with spaces) as a pattern anywhere within the entire value of a field using the /abstractitems endpoint "contains" field?

    My other question is, are there wildcard characters that we can use in the "contains" field?



  • 2.  RE: REST API /abstractitems contains field

    Posted 02-09-2018 11:41
    Hi Victor,

    Thanks for your question! We are working on this in a support ticket, but once I have the behavior of 'contains' outlined, I will also publicly post it here.

    Sara Jensen
    Developer Support Engineer
    Jama Software
    Portland OR

  • 3.  RE: REST API /abstractitems contains field

    Posted 03-27-2019 12:08
    Hi Sara, could you provide an update on this ticket?
    The request is simple -
    how can you search for a phrase (which contains spaces) using the abstractitems API?


    Neil Schaper

  • 4.  RE: REST API /abstractitems contains field

    Posted 03-27-2019 12:42
    Edited by Neil Schaper 03-29-2019 13:17
    I was playing with this and found a solution.
    Say you are searching for a phrase in any item field
       "one two three"

    The following will work in the contains parameter for abstractitems:
    ""one two three""

    if you want to search a specific field (e.g, name), this will work:
    "name:("one two three")"

    This only works if you specify whole words in your search phrase.  So the following won't give you a search hit:
    ""one two thr""
    This "must use whole words" limitation also applies to the Jama Browser search BTW.

    Please provide feedback on the above approach.  Is this the recommended way to search for phrases?

    Neil Schaper

  • 5.  RE: REST API /abstractitems contains field

    Posted 04-02-2019 16:08
    Hi Neil:

    Have you seen our new API Cookbook, it's a living document our Product team has created. It just happens to have some really good use case information about the Abstract items endpoint as well as the Contains parameter: API Cookbook/Searching with the Abstract Items Endpoint.

    Hope this will be a helpful resource for you!

    Chloe Elliott
    Jama Software
    Portland OR