Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Query items in structure

Daniel Breneis July 12, 2022

I use structure and have managed via postman to get following result for my query 

https://<servername>/jira/rest/structure/2.0/forest/latest?s={%22structureId%22:362}

result:

{
    "spec": {
        "structureId"362
    },
    "formula""18160:0:1/632,18170:0:1/642,18134:0:1/606,18148:0:1/620,59943:0:40863:3,59945:1:38270:4,59949:2:54210:4,59999:3:54130:4,67223:4:54701:4,67219:4:54696:4,67217:4:54694:4,60017:4:54135:4,67221:4:54700:4,65749:4:54633:4,60019:4:54201:4,65577:4:54630:4,60021:4:54416:4,59947:2:54215:4,59981:3:54233:4,60003:4:54319:4,60009:4:54299:4,60007:4:54306:4,60001:4:54152:4,60005:4:54321:4,59991:3:54234:4,60013:4:53849:4,60015:4:53850:4,66539:4:54658:4,66541:4:54659:4,59993:3:54235:4,59997:3:54236:4,59979:3:54237:4,60011:4:52576:4,59983:3:54238:4,59965:3:54223:4,59967:3:54224:4,59995:3:54242:4,59987:3:54243:4,59973:3:54227:4,59989:3:54245:4,59977:3:54240:4,59985:3:54239:4,67671:2:54723:4,67677:2:54725:4",
    "itemTypes": {
        "1""com.almworks.jira.structure:type-generator"
    },
    "version": {
        "signature"1636704433,
        "version"1
    }
}

I simply don't understand the documentation how to retrieve the Jira-items from "formula" (https://wiki.almworks.com/documentation/structure/latest/data-center-and-server/forest-resource-32223494.html)

How can I translate the returned elements to Jira-items like "QA-19"?

1 answer

1 accepted

2 votes
Answer accepted
David Niro
Atlassian Partner
July 25, 2022

Hello @Daniel Breneis ,

David from ALM Works here.

I checked with a colleague, and the next request you will want to execute is the value request:

POST $baseUrl/rest/structure/2.0/value

To run this request you need the rows received from the forest request you already made. The forest request brings the formula. Specifically this part:

18160:0:1/632,18170:0:1/642,18134:0:1/606,18148:0:1/620,59943:0:40863:3,59945:1:38270:4,59949:2:54210:4,59999:3:54130:4,67223:4:54701:4,67219:4:54696:4,67217:4:54694:4,60017:4:54135:4,67221:4:54700:4,65749:4:54633:4,60019:4:54201:4,65577:4:54630:4,60021:4:54416:4,59947:2:54215:4,59981:3:54233:4,60003:4:54319:4,60009:4:54299:4,60007:4:54306:4,60001:4:54152:4,60005:4:54321:4,59991:3:54234:4,60013:4:53849:4,60015:4:53850:4,66539:4:54658:4,66541:4:54659:4,59993:3:54235:4,59997:3:54236:4,59979:3:54237:4,60011:4:52576:4,59983:3:54238:4,59965:3:54223:4,59967:3:54224:4,59995:3:54242:4,59987:3:54243:4,59973:3:54227:4,59989:3:54245:4,59977:3:54240:4,59985:3:54239:4,67671:2:54723:4,67677:2:54725:4

The formula format is: <rowId>:<depth>:<issueId>|<itemType>, so using the provided numbers as example, we have:

59943:0:40863:3

rowId: 59943
depth: 0
issueId: 40863
itemType: 3

Item types 3 or 4 are typically the issues. Here, item type 1 are the generators.

Once you have the rows and the attribute specification, you can follow the example in the documentation I linked above.

{
  "requests": [
    {
      "forestSpec": {
        "structureId": 123
      },
      "rows": [
        1820,
        1842,
        2122
      ],
      "attributes": [
        {
          "id": "summary",
          "format": "text"
        },
        {
          "id": "key",
          "format": "html"
        },
        {
          "id": "progress",
          "format": "number",
          "params": {
            "basedOn": "timetracking",
            "resolvedComplete": true,
            "weightBy": "equal"
          }
        }
      ]
    }
  ]
}

Please let me know if this helps.

Best,
David

Suggest an answer

Log in or Sign up to answer