It's all about the answers!

Ask a question

How to get all records from Reportable REST API?


Amol Wangate (159) | asked Jun 26 '19, 8:39 a.m.
I've this REST API : https://xyx:8085/ccm/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='Defect Management']/(id|summary|allExtensions[displayName='External ID']/(displayName|displayValue)) and it only returns limited number of recrods. However, I need all. What changes do I need to make to the mentioned url to get all the records.

2nd question: is it possbile to apply filter and get only the records where 'External ID' is NOT NULL?


Comments
Amol Wangate commented Jun 27 '19, 2:36 p.m.

Davyd Norris commented Jun 29 '19, 10:32 p.m.

Probably need to know how many records it's returning before this question can be answered


Amol Wangate commented Jul 01 '19, 5:56 a.m.

100 records by default


Subramanya Prasad Pilar commented Jul 01 '19, 6:43 a.m.

Does appending size parameter (ex. size=5000) help?


Amol Wangate commented Jul 01 '19, 6:45 a.m.

actually, I'm looking for all records.


Davyd Norris commented Jul 01 '19, 8:51 p.m.
I found an existing question that may give you some ideas - this is for RQM but I would assume it is also relevant for the others


Amol Wangate commented Jul 03 '19, 9:52 a.m.

all I could undestand from there, that change the max feed setting entries in Advanced properties. But then how do we determine what the max feed limit should be?

showing 5 of 7 show 2 more comments

One answer



permanent link
Davyd Norris (2.2k217) | answered Jun 29 '19, 10:36 p.m.
Only a limited number of basic XPath filters are implemented in the Reportable REST API. This is how you can apply further filters on the returned data - this code returns all team members with a specific role in a team area:

  var getTeamMembersWithRole = function(team, role) {
    if (!team || !role) {
      console.log('getTeamMembersWithRole: Error! team = ' + team + ', role = '
          + role);
      return null;
    }

    var xhrArgs = {
      url : '/ccm/rpt/repository/foundation?fields=foundation/teamArea[itemId='
          + team
          + ']/roleAssignments/(contributor/itemId|contributorRoles/name)',
      headers : {
        'Accept' : 'application/xml'
      },
      handleAs : 'xml'
    };

    return jazzClient.xhrGet(xhrArgs).then(
        function(data) {
          var memberIds = data.evaluate(
              'foundation/teamArea/roleAssignments[contributorRoles/name/text()="'
                  + role + '"]/contributor/itemId', data, null,
              XPathResult.ANY_TYPE, null);

          var members = 0 || [];
          var id = memberIds.iterateNext();

          while (id !== null) {
            members.push(id.textContent);
            id = memberIds.iterateNext();
          }

          return members;
        });
  };


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.