Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,252
Community Members
 
Community Events
168
Community Groups

Jira Rest API Pagination

I am now on an internship and need to connect the jira rest api and our website. The connection works and I have already collected the project versions.

the version list is very long. So I want to make sure that you only see 5 versions per page. By that I mean that if there are more than 5 items in the list, it will automatically create a new page with the rest of the list.

I've searched everywhere for an answer, but haven't been able to find anything yet. someone who has been able to find a tutorial or can explain themselves how it works.

btw i work in php.

 

The code i use to get the project versions

        $items = [];

        try {

            $param = [

                'startAt' => 0,

                'maxResults' => 5,

                'orderBy' => '-name',

            ];

            $proj = new ProjectService();

            $items = $proj->getVersionsPagenated('TEST', $param);

            foreach ($items as $v) {

                echo "<hr>";

                var_dump($v->name, $v->self, $v->id, $v->releaseDate);

                echo "<br>";

            }

1 answer

1 vote

Hi,

Welcome to the community.

You could try to get all the project version in a list, then take the length of the list and if it's greater that 5 take the 5 first item send them to the first page and create other page for the rest of the list

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events