How to get all records from Reportable REST API?
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?
One answer
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;
});
};
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;
});
};
Comments
Amol Wangate
Jun 27 '19, 2:36 p.m.Davyd Norris any idea?
Davyd Norris
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
Jul 01 '19, 5:56 a.m.100 records by default
Subramanya Prasad Pilar
Jul 01 '19, 6:43 a.m.Does appending size parameter (ex. size=5000) help?
Amol Wangate
Jul 01 '19, 6:45 a.m.actually, I'm looking for all records.
Davyd Norris
Jul 01 '19, 8:51 p.m.Amol Wangate
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?