We pull data from Jira to PowerBI using rest API Search functionality with below API call
We used https://**Our*Company**.atlassian.net/rest/api/latest/search?jql=project in (**Our*Project)&fields=(Fields*) to get below details for pagenation.
"expand": "schema,names","startAt": 0,"maxResults": 100,"total": 5081,
But recently Jira has migrated to below link
https://**Our*Company**.atlassian.net/rest/api/latest/search/jql?jql=project in (**Our*Project)&fields=(Fields*)
Which is not fetching any of header details(MaxResult or total) hence we are not able to pull data into PowerBI. Can you suggest how we can get header details with search rest API functionality ?
Hi @Dheeraj S Gaddi
Welcome to Atlassian community and thank you for your question.
Try with the new parameters is last and nextpageToken, as indicated in the API doc: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get
The new API for Jql searchabia not performing very well, we hope it will be improved.
Regards
@Matteo Vecchiato Thank you Very much.
I was able to use "Is Last" and "Next page Token" to create pagination, it was bit of work but jql works fine.
Could you share the syntax you used? I am in the same boat, and can't get pagination to work,
Thanks!
letBaseUrl = "https://Company.com/rest/api/3/search/jql",JQL = "project = *Project_Name* ORDER BY created DESC",MaxResults = 100,AuthHeader = "Basic " & Binary.ToText(Text.ToBinary("Email:API Token"), BinaryEncoding.Base64),
// Function to fetch one pageGetPage = (nextPageToken as nullable text) as record =>letQueryParams =if nextPageToken = null then[jql = JQL,maxResults = Text.From(MaxResults),fields = "Fields_Required"]else[jql = JQL,maxResults = Text.From(MaxResults),nextPageToken = nextPageToken,fields = "Fields_Required"],
Source = Json.Document(Web.Contents(BaseUrl,[Headers = [Authorization = AuthHeader,Accept = "application/json"],Query = QueryParams])),Issues = try Source[issues] otherwise {},Token = if Record.HasFields(Source, "nextPageToken") then Source[nextPageToken] else null,Result = [Issues=Issues, NextToken=Token]inResult,
// Loop through ALL pages safelyAllPages = List.Generate(() => GetPage(null),each _ <> null,each if _[NextToken] <> null then GetPage(_[NextToken]) else null,each _[Issues]),
Combined = List.Combine(AllPages),
// Always create a table with predictable column nameIssuesTable = if List.Count(Combined) > 0then Table.FromList(Combined, Splitter.SplitByNothing(), {"Issue"}, null, ExtraValues.Error)else #table({"Issue"}, {}),
Expanded = Table.ExpandRecordColumn(IssuesTable, "Issue", {"id", "key", "fields"}, {"id","key","fields"}),
// Expand your requested fieldsFinal = Table.ExpandRecordColumn(Expanded,"fields",{"Fields_Required"},{"Fields_Required"})inFinal
It looks like you're new here. Sign in or register to get started.