Skip to content

Include pagination fields in request

Carla Drago requested to merge 417578-fix-api-request into master

What does this MR do and why?

Adds pagination fields in bitbucket PR get request. Without them pagination does not work and only a max of 50 records are returned by the BitBucket API

pagelen
size
page
next
previous

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

API Request

GET
https://api.bitbucket.org/2.0/repositories/kitchencoders/frogger/pullrequests?state=ALL&sort=created_on&fields=pagelen,size,page,values.comment_count,values.task_count,values.type,values.id,values.title,values.description,values.state,values.merge_commit,values.close_source_branch,values.closed_by,values.author,values.reason,values.created_on,values.updated_on,values.destination,values.source,values.links,values.summary,values.reviewers

Before

Click to expand
{
    "values": [
        {
            "comment_count": 0,
            "type": "pullrequest",
            "id": 1,
            "title": "Add client spec",
            "description": "Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.",
            "state": "MERGED",
            "merge_commit": {
                "hash": "ac66cf0fcbf3",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/ac66cf0fcbf3"
                    },
                    "html": {
                        "href": "https://bitbucket.org/gitlab-ps/frogger/commits/ac66cf0fcbf3"
                    }
                },
                "type": "commit"
            },
            "close_source_branch": true,
            "closed_by": {
                "display_name": "Evgeny",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D"
                    },
                    "avatar": {
                        "href": "https://secure.gravatar.com/avatar/edf936c1fd38aab9ca6fa2fae803b317?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-4.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D/"
                    }
                },
                "type": "user",
                "uuid": "{665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1}",
                "account_id": "712020:ca874e03-e9d5-4d2a-94ee-b1a451f28980",
                "nickname": "erudinsky-gitlab"
            },
            "author": {
                "display_name": "Carla Drago",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/%7B31083074-7bd0-4fa2-ac55-840f79884d7d%7D"
                    },
                    "avatar": {
                        "href": "https://secure.gravatar.com/avatar/f81cded114c463628611a73640f8dff4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCD-5.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/%7B31083074-7bd0-4fa2-ac55-840f79884d7d%7D/"
                    }
                },
                "type": "user",
                "uuid": "{31083074-7bd0-4fa2-ac55-840f79884d7d}",
                "account_id": "63cebb8cce7f4b4e14f93219",
                "nickname": "Carla Drago"
            },
            "reason": "",
            "created_on": "2024-06-14T10:27:32.056759+00:00",
            "updated_on": "2024-06-19T14:48:34.141129+00:00",
            "destination": {
                "branch": {
                    "name": "update-client"
                },
                "commit": {
                    "hash": "244eba9ad20d",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/244eba9ad20d"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger/commits/244eba9ad20d"
                        }
                    },
                    "type": "commit"
                },
                "repository": {
                    "type": "repository",
                    "full_name": "gitlab-ps/frogger",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger"
                        },
                        "avatar": {
                            "href": "https://bytebucket.org/ravatar/%7B1f55503d-e0b8-401d-a8b6-6e5105cb37b5%7D?ts=ruby"
                        }
                    },
                    "name": "frogger",
                    "uuid": "{1f55503d-e0b8-401d-a8b6-6e5105cb37b5}"
                }
            },
            "source": {
                "branch": {
                    "name": "Carla-Drago/client_specrb-created-online-with-bitbuc-1718360836531"
                },
                "commit": {
                    "hash": "a0865abfcc29",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/a0865abfcc29"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger/commits/a0865abfcc29"
                        }
                    },
                    "type": "commit"
                },
                "repository": {
                    "type": "repository",
                    "full_name": "gitlab-ps/frogger",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger"
                        },
                        "avatar": {
                            "href": "https://bytebucket.org/ravatar/%7B1f55503d-e0b8-401d-a8b6-6e5105cb37b5%7D?ts=ruby"
                        }
                    },
                    "name": "frogger",
                    "uuid": "{1f55503d-e0b8-401d-a8b6-6e5105cb37b5}"
                }
            },
            "reviewers": [
                {
                    "display_name": "Evgeny Rudinsky",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B8acf1ef0-9fb7-442f-a9f3-bd0e36382068%7D"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:e16ca357-768f-463a-85d0-4538d9803d37/7c0770a1-e45e-46d6-be50-8de52c1c1b33/128"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B8acf1ef0-9fb7-442f-a9f3-bd0e36382068%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{8acf1ef0-9fb7-442f-a9f3-bd0e36382068}",
                    "account_id": "557058:e16ca357-768f-463a-85d0-4538d9803d37",
                    "nickname": "evgeny_rudinsky"
                },
                {
                    "display_name": "Karina",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B75364e21-112d-4381-9ec7-dcd615f0a690%7D"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/69038805aaa4fe6d8bc40a7473e614ce?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FK-3.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B75364e21-112d-4381-9ec7-dcd615f0a690%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{75364e21-112d-4381-9ec7-dcd615f0a690}",
                    "account_id": "712020:ec43c269-a145-45cc-9cf2-3c168018768d",
                    "nickname": "krudinskaia"
                },
                {
                    "display_name": "Evgeny",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/edf936c1fd38aab9ca6fa2fae803b317?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-4.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1}",
                    "account_id": "712020:ca874e03-e9d5-4d2a-94ee-b1a451f28980",
                    "nickname": "erudinsky-gitlab"
                }
            ],
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1"
                },
                "html": {
                    "href": "https://bitbucket.org/gitlab-ps/frogger/pull-requests/1"
                },
                "commits": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/commits"
                },
                "approve": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/approve"
                },
                "request-changes": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/request-changes"
                },
                "diff": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/diff/gitlab-ps/frogger:a0865abfcc29%0D244eba9ad20d?from_pullrequest_id=1&topic=true"
                },
                "diffstat": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/diffstat/gitlab-ps/frogger:a0865abfcc29%0D244eba9ad20d?from_pullrequest_id=1&topic=true"
                },
                "comments": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/comments"
                },
                "activity": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/activity"
                },
                "merge": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/merge"
                },
                "decline": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/decline"
                },
                "statuses": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/statuses"
                }
            },
            "summary": {
                "type": "rendered",
                "raw": "Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.",
                "markup": "markdown",
                "html": "<p>Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.</p>"
            }
        }  
    ]
}

After

Click to expand
{
    "values": [
        {
            "comment_count": 0,
            "type": "pullrequest",
            "id": 1,
            "title": "Add client spec",
            "description": "Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.",
            "state": "MERGED",
            "merge_commit": {
                "hash": "ac66cf0fcbf3",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/ac66cf0fcbf3"
                    },
                    "html": {
                        "href": "https://bitbucket.org/gitlab-ps/frogger/commits/ac66cf0fcbf3"
                    }
                },
                "type": "commit"
            },
            "close_source_branch": true,
            "closed_by": {
                "display_name": "Evgeny",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D"
                    },
                    "avatar": {
                        "href": "https://secure.gravatar.com/avatar/edf936c1fd38aab9ca6fa2fae803b317?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-4.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D/"
                    }
                },
                "type": "user",
                "uuid": "{665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1}",
                "account_id": "712020:ca874e03-e9d5-4d2a-94ee-b1a451f28980",
                "nickname": "erudinsky-gitlab"
            },
            "author": {
                "display_name": "Carla Drago",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/%7B31083074-7bd0-4fa2-ac55-840f79884d7d%7D"
                    },
                    "avatar": {
                        "href": "https://secure.gravatar.com/avatar/f81cded114c463628611a73640f8dff4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCD-5.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/%7B31083074-7bd0-4fa2-ac55-840f79884d7d%7D/"
                    }
                },
                "type": "user",
                "uuid": "{31083074-7bd0-4fa2-ac55-840f79884d7d}",
                "account_id": "63cebb8cce7f4b4e14f93219",
                "nickname": "Carla Drago"
            },
            "reason": "",
            "created_on": "2024-06-14T10:27:32.056759+00:00",
            "updated_on": "2024-06-19T14:48:34.141129+00:00",
            "destination": {
                "branch": {
                    "name": "update-client"
                },
                "commit": {
                    "hash": "244eba9ad20d",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/244eba9ad20d"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger/commits/244eba9ad20d"
                        }
                    },
                    "type": "commit"
                },
                "repository": {
                    "type": "repository",
                    "full_name": "gitlab-ps/frogger",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger"
                        },
                        "avatar": {
                            "href": "https://bytebucket.org/ravatar/%7B1f55503d-e0b8-401d-a8b6-6e5105cb37b5%7D?ts=ruby"
                        }
                    },
                    "name": "frogger",
                    "uuid": "{1f55503d-e0b8-401d-a8b6-6e5105cb37b5}"
                }
            },
            "source": {
                "branch": {
                    "name": "Carla-Drago/client_specrb-created-online-with-bitbuc-1718360836531"
                },
                "commit": {
                    "hash": "a0865abfcc29",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/commit/a0865abfcc29"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger/commits/a0865abfcc29"
                        }
                    },
                    "type": "commit"
                },
                "repository": {
                    "type": "repository",
                    "full_name": "gitlab-ps/frogger",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger"
                        },
                        "html": {
                            "href": "https://bitbucket.org/gitlab-ps/frogger"
                        },
                        "avatar": {
                            "href": "https://bytebucket.org/ravatar/%7B1f55503d-e0b8-401d-a8b6-6e5105cb37b5%7D?ts=ruby"
                        }
                    },
                    "name": "frogger",
                    "uuid": "{1f55503d-e0b8-401d-a8b6-6e5105cb37b5}"
                }
            },
            "reviewers": [
                {
                    "display_name": "Evgeny Rudinsky",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B8acf1ef0-9fb7-442f-a9f3-bd0e36382068%7D"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:e16ca357-768f-463a-85d0-4538d9803d37/7c0770a1-e45e-46d6-be50-8de52c1c1b33/128"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B8acf1ef0-9fb7-442f-a9f3-bd0e36382068%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{8acf1ef0-9fb7-442f-a9f3-bd0e36382068}",
                    "account_id": "557058:e16ca357-768f-463a-85d0-4538d9803d37",
                    "nickname": "evgeny_rudinsky"
                },
                {
                    "display_name": "Karina",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B75364e21-112d-4381-9ec7-dcd615f0a690%7D"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/69038805aaa4fe6d8bc40a7473e614ce?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FK-3.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B75364e21-112d-4381-9ec7-dcd615f0a690%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{75364e21-112d-4381-9ec7-dcd615f0a690}",
                    "account_id": "712020:ec43c269-a145-45cc-9cf2-3c168018768d",
                    "nickname": "krudinskaia"
                },
                {
                    "display_name": "Evgeny",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/edf936c1fd38aab9ca6fa2fae803b317?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-4.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1%7D/"
                        }
                    },
                    "type": "user",
                    "uuid": "{665b0d7a-afa9-4c82-9e7e-01e6df7ca3c1}",
                    "account_id": "712020:ca874e03-e9d5-4d2a-94ee-b1a451f28980",
                    "nickname": "erudinsky-gitlab"
                }
            ],
            "links": {
                "self": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1"
                },
                "html": {
                    "href": "https://bitbucket.org/gitlab-ps/frogger/pull-requests/1"
                },
                "commits": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/commits"
                },
                "approve": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/approve"
                },
                "request-changes": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/request-changes"
                },
                "diff": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/diff/gitlab-ps/frogger:a0865abfcc29%0D244eba9ad20d?from_pullrequest_id=1&topic=true"
                },
                "diffstat": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/diffstat/gitlab-ps/frogger:a0865abfcc29%0D244eba9ad20d?from_pullrequest_id=1&topic=true"
                },
                "comments": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/comments"
                },
                "activity": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/activity"
                },
                "merge": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/merge"
                },
                "decline": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/decline"
                },
                "statuses": {
                    "href": "https://api.bitbucket.org/2.0/repositories/gitlab-ps/frogger/pullrequests/1/statuses"
                }
            },
            "summary": {
                "type": "rendered",
                "raw": "Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.",
                "markup": "markdown",
                "html": "<p>Purus semper eget duis at tellus at urna. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Nec ullamcorper sit amet risus nullam. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Volutpat ac tincidunt vitae semper quis lectus nulla at volutpat.</p>"
            }
        }
    ]
    "pagelen": 10,
    "size": 4,
    "page": 1
}

Related to #417578 (closed)

Edited by Bojan Marjanovic

Merge request reports

Loading