No next page URL returned from Bitbucket/Pipelines API in spite of large data set. Edited

Tl;dr this started off as a request for help, but i've figured out how to get hold of the data, I think there's a bug with the next param on the API response.

I'm having difficulty iterating over the data returned from GET `/2.0/repositories/{username}/{repo_slug}/pipelines/` as the 'next' parameter used to call subsequent pages of the paginated data is returning None.

print(res.next)
None

data = res.json()

data.keys()
dict_keys(['values', 'pagelen', 'size', 'page'])

len(data['values'])
10


data['size']
189

print(data['values'][0])
{'completed_on': '2016-06-01T16:36:37.715Z', 'repository': {'type': 'repository', 'full_name': 'redacted', 'uuid': '{4cd38c15-a83c-4c99-bbe5-b38e446e2ac6}', 'name': 'redacted', 'links': {'self': {'href': 'https://api.bitbucket.org/2.0/repositories/user/repo'}, 'html': {'href': 'https://bitbucket.org/user/repo'}, 'avatar': {'href': 'https://bitbucket.org/user/repo/avatar/32/'}}}, 'state': {'type': 'pipeline_state_completed', 'result': {'type': 'pipeline_state_completed_failed', 'name': 'FAILED'}, 'name': 'COMPLETED'}, 'trigger': {'type': 'pipeline_trigger_push', 'name': 'PUSH'}, 'created_on': '2016-06-01T16:36:20.847Z', 'uuid': '{539bcae7-e9a4-43ce-b19d-507fae002e4c}', 'build_seconds_used': 10, 'target': {'ref_name': 'master', 'selector': {'type': 'default'}, 'commit': {'type': 'commit', 'hash': '7fae9efeac7d94139535603d6477821eac7d69f4', 'links': {'self': {'href': 'https://api.bitbucket.org/2.0/repositories/user/repo/commit/7fae9efeac7d94139535603d6477821eac7d69f4'}, 'html': {'href': 'https://bitbucket.org/user/repo/commits/7fae9efeac7d94139535603d6477821eac7d69f4'}}}, 'ref_type': 'branch', 'type': 'pipeline_ref_target'}, 'type': 'pipeline', 'creator': {'type': 'user', 'uuid': '{09a7942a-9f11-4e29-835b-6091b49ee6f2}', 'username': 'user', 'links': {'self': {'href': 'https://api.bitbucket.org/2.0/users/user'}, 'html': {'href': 'https://bitbucket.org/user/'}, 'avatar': {'href': 'https://bitbucket.org/account/user/avatar/32/'}}, 'display_name': 'User'}, 'build_number': 1}


 

Update:
I have been able to access the data by dividing the data['size'] by pagelen, and then making subsequent requests by building up the URL string manually.

 

Also, are there any parameters I can pass to the request in order to sort the data by completed on date?

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

408 views 5 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you