Jira Align REST call, pagination, and foreign keys
Need help on collecting data from Jira Align. I want to get User and related Team data. I loop with pagination but the "__KEY_root" is repeated for every hundred records. Each pass restarts the key at 0. This renders the FK useless. I want to end up with two tables; a user table and a lookup table with the teams that user is a member of.
User: column 1 = user_id, column 2 = __KEY_root
Team: column 1 = team_id, column 2 = the same __FK_root from above
The result would be a one (user) to many relationship (teams).
How do I solve?
Here is the code:
DO
RestConnectorMasterTable: SQL SELECT "id", "fullName", "status", "__KEY_root", (SELECT "teamId", "teamName", "__FK_teams" FROM "teams" FK "__FK_teams") FROM JSON (wrap on) "root" PK "__KEY_root" WITH CONNECTION (URL "$(vBaseURL)?top=$(vTop)&skip=$(vSkip)");
LET vTotal = peek('id', $(vSkip), 'RestConnectorMasterTable'); LET vSkip = $(vSkip) + $(vTop); LET OldRowCount=rowCount; LET rowCount = NoOfRows('RestConnectorMasterTable');