API: Obtain list of child requirements [RQ] belonging to parent

Thursday, October 7, 2021
Avatar

Currently, I'm trying to find a way to calculate contribution of each requirement's weight within whole requirement structure. 

I already have a custom property on requirement level named Weight (it takes values from a list 2^n where n>0 and n<10 i.e 2,4,8,16...1024). So I want to compare all requirements on the same indentation level to get their relative contribution in terms of that Weight values.

So, my question is, as stated in the title - is there any way to get the list of children requirements of a particular requirement using API?

2 Replies
Friday, October 8, 2021
Avatar
re: goran.kurucev Thursday, October 7, 2021

In general, this API call retrieves requirements based on a filter:

http://api.inflectra.com/Spira/Services/v6_0/RestServiceOperation.aspx?uri=projects%2f%7bproject_id%7d%2frequirements%2fsearch%3fstarting_row%3d%7bstarting_row%7d%26number_of_rows%3d%7bnumber_of_rows%7d&method=POST

However I don't think it will get requirements that are children of a specific one, it relies on filtering by a field.

I would log a help desk ticket to get an enhancement raised since it is a good idea.

Sunday, October 10, 2021
Avatar
re: inflectra.david Friday, October 8, 2021

Thanks for your reply. I managed to successfully get the list of direct children requirements by using IndentLevel property.  If parent is known, its direct children (only) have a length of IndentLevel property that is 3 greater than parent's IndentLevel, and child's IndentLevel property substring after trimming  the last three chars is the same as their parent's IndentLevel.  Nevertheless, it would be quite useful to have a parentId property, if possible.

Statistics
  • Started: Thursday, October 7, 2021
  • Last Reply: Sunday, October 10, 2021
  • Replies: 2
  • Views: 167