Jump to content

The swarm api review records more than 1000 records


  • Please log in to reply
1 reply to this topic

#1 hoang.nth



  • Members
  • PipPip
  • 16 posts

Posted 26 October 2015 - 06:52 AM

Hello supporters,

I have problems when use swarm review api. And i hope that you could help me.

+ The api provided only 1000 records by setting the max value at the source code.
+ Even we can increase the max value, but we dont have all the raw data. And may be we could missing some update reviews. Ex:
There is a review with the order  is 1001, and probably that this review will be out of the api records.
Then the user update this review, so we will miss this update information.
Of course we can increase the Max value > 1000, but we still have some cases that we miss the data.

So is there any way for get all the raw data?

PS: I think that we can delete the param 'max' in function getList() of review API. But if our company have around total more than 1.000.000 changes, so what happen?
      Because actually the function getList() will manipulate with the all Data, even it is a huge data or not. The performance may be only increased when we parse the raw data to json.

Best Regards,

#2 Andrew DeFaria

Andrew DeFaria

    Advanced Member

  • Members
  • PipPipPip
  • 125 posts

Posted 02 December 2015 - 06:01 PM

I would think that if it's anything like JIRA the API would have something like startAt=<n> where n is the record number where to start returning data. So then you'd write a function that would do something like:

sub getIssues (;$$$@) {
  my ($condition, $start, $max, @fields) = @_;

  push @fields, '*all' unless @fields;

  my ($result, %query);

  $query{jql}		= $condition || '';
  $query{startAt}	= $start	 || 0;
  $query{maxResults} = $max	   || 50;
  $query{fields}	 = join ',', @fields;

  eval {$result = $jira->GET ('/search/', \%query)};
  return @{$result->{issues}};
} # getIssues

# Then you would process them like:

do { 
  @issues = getIssues (undef, $start, 1000, qw(key customfield_10129));

  $log->msg ("Processing issues $start-" . ($start + @issues));

  $start += @issues;

  for (@issues) {
	$total{'Issues Processed'}++;
	my %issue = %$_;
	# Process issue
  } # for
} until @iissues == 0;

By playing with $max and $start you can effectively get as little or as much of the data that you want.

Now this is for JIRA and not Swarm but I would hope the mechanism is similar. I don't see anywhere in Perforce's Swarm REST API that describes anything like that. Their documentation is kinda sketchy. Hopefully they will respond.

Also tagged with one or more of these keywords: swarm

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users