Best API method for getting abstractitems based upon partial string

Fraser Macmillen
Fraser Macmillen Member Posts: 7

Apologies if this is the wrong place to ask this. I am trying to find a way of using the Jama REST API to get items based upon matching the start of a string only. For example, I can use:

.../rest/latest/abstractitems/?project=35&contains=%22documentKey%22:MY-PREFIX_SLR-222"

to return a specific item, but what is the bext method of returning all items whose documentKey begins with "MY-PREFIX_SLR" for example. 

Best Regards, Fraser

------------------------------
Fraser Macmillen
Vertical Aerospace
Bristol
------------------------------

Comments

  • [Deleted User]
    [Deleted User] Posts: 152
    edited March 2023

    Hi Fraser, 

    Just to clarify, in your example, is the following accurate?

    MY=projectid (e.g. 35)
    PREFIX_SLR=itemtypeid (e.g. 123)
    222=item number

    ------------------------------
    Carly Rossi // she/her
    Community Manager // Jama Software
    Portland, OR
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 03-07-2023 00:33
    From: Fraser Macmillen
    Subject: Best API method for getting abstractitems based upon partial string

    Apologies if this is the wrong place to ask this. I am trying to find a way of using the Jama REST API to get items based upon matching the start of a string only. For example, I can use:

    .../rest/latest/abstractitems/?project=35&contains=%22documentKey%22:MY-PREFIX_SLR-222"

    to return a specific item, but what is the bext method of returning all items whose documentKey begins with "MY-PREFIX_SLR" for example. 

    Best Regards, Fraser

    ------------------------------
    Fraser Macmillen
    Vertical Aerospace
    Bristol
    ------------------------------
  • Fraser Macmillen
    Fraser Macmillen Member Posts: 7
    edited March 2023

    Hello Carly

    Thanks for responding Carly, I have now resolved this issue, but I'm sure you could kelp my understanding.
    In terms of achieving what I wanted it was simpler than I thought as I eventually realised that using: 

    .../rest/latest/abstractitems/?project=35&contains=%22documentKey%22:MY-PREFIX-SLR-
    will return all items whose documentKey starts with "MY-PREFIX-SLR-", which is exactly what I wanted, I thought I would need to define some kind of wildcard and so tried various ways of doing that before I realised I didn't need to!
    To answer your question though, "MY-PREFIX-SLR-XXX" is what I see as the Project Id for each item, with XXX being digits unique to each item. The prefix varies with component and item type, so for example text items in my set of requirements appear with "MY-PREFIX-TXT-XXX"; or requirements under another component in the project appear with "MY-OTHERPREFIX-SLR-XXX".
    The first part of the string "MY" seems to correspond to the project. I'm not sure how these documentKeys get created.

    I just wanted a way to extract all items of type "requirement" from a particular component, and can now do so, but maybe there is a more elegant way?

    I am happy though - that I am now able to extract information from Jama into MATLAB and parse information from the requirement object - which offers a multitude of automation and "single-source of truth" benefits.

    Best Regards
    Fraser

    ------------------------------
    Fraser Macmillen
    Vertical Aerospace
    Bristol
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 03-28-2023 16:13
    From: Carly Rossi
    Subject: Best API method for getting abstractitems based upon partial string

    Hi Fraser, 

    Just to clarify, in your example, is the following accurate?

    MY=projectid (e.g. 35)
    PREFIX_SLR=itemtypeid (e.g. 123)
    222=item number

    ------------------------------
    Carly Rossi // she/her
    Community Manager // Jama Software
    Portland, OR
    ------------------------------

    Original Message:
    Sent: 03-07-2023 00:33
    From: Fraser Macmillen
    Subject: Best API method for getting abstractitems based upon partial string

    Apologies if this is the wrong place to ask this. I am trying to find a way of using the Jama REST API to get items based upon matching the start of a string only. For example, I can use:

    .../rest/latest/abstractitems/?project=35&contains=%22documentKey%22:MY-PREFIX_SLR-222"

    to return a specific item, but what is the bext method of returning all items whose documentKey begins with "MY-PREFIX_SLR" for example. 

    Best Regards, Fraser

    ------------------------------
    Fraser Macmillen
    Vertical Aerospace
    Bristol
    ------------------------------