Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API PAGINATION JIRA V3

BARBARA EUSEBIO
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 30, 2025

Hello

I have this code here that I'm putting in power bi to get all issues from a project but its giving me bad request. I want all the isues from january 2025 till now. Someone can help me adjusting the code below please?

 

let
// Parâmetros
url = "https://eci-td.atlassian.net/rest/api/3/search/jql",
email = "xxx",
apiToken = "xxx",
auth = "Basic " & Binary.ToText(Text.ToBinary(email & ":" & apiToken), BinaryEncoding.Base64),

// Função para obter uma página
GetPage = (startAt as number) =>
let
body = Text.ToBinary("{ ""jql"": ""project = CC AND type != Sub-task AND 'customfield_10136' >= '2025-01-01' AND 'customfield_10136' <= now() ORDER BY created DESC"", ""startAt"": " & Number.ToText(startAt) & ", ""maxResults"": 100, ""fields"": [
""key"", ""summary"", ""status"", ""created"", ""updated"", ""assignee"", ""reporter"", ""creator"", ""resolution"", ""duedate"", ""description"", ""issuetype"",
""customfield_10121"", ""customfield_10108"", ""customfield_10136"", ""customfield_10107"", ""customfield_10110"", ""customfield_10111"", ""customfield_10232"",
""customfield_10114"", ""customfield_10208"", ""customfield_10141"", ""customfield_10142""
] }"),
response = Json.Document(Web.Contents(url, [
Headers = [
Authorization = auth,
#"Content-Type" = "application/json",
Accept = "application/json"
],
Content = body
])),
issues = response[issues]
in
issues,

// Função recursiva para obter todas as páginas
GetAllPages = (startAt as number, acc as list) =>
let
page = GetPage(startAt),
newAcc = List.Combine({acc, page}),
nextStart = startAt + List.Count(page)
in
if List.Count(page) = 100 then @GetAllPages(nextStart, newAcc) else newAcc,

// Obter todas as issues
allIssues = GetAllPages(0, {}),

// Transformar em tabela
tabelaExpandida = Table.FromList(allIssues, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
tabelaComCampos = Table.ExpandRecordColumn(tabelaExpandida, "Column1", {"key", "fields"}),

camposExpandidos = Table.ExpandRecordColumn(tabelaComCampos, "fields", {
"summary", "status", "created", "updated", "assignee", "reporter", "creator", "resolution", "duedate", "description", "issuetype",
"customfield_10121", "customfield_10108", "customfield_10136", "customfield_10107", "customfield_10110", "customfield_10111", "customfield_10232",
"customfield_10114", "customfield_10208", "customfield_10141", "customfield_10142"
}),

statusExpandido = Table.ExpandRecordColumn(camposExpandidos, "status", {"name"}, {"Estado"}),
assigneeExpandido = Table.ExpandRecordColumn(statusExpandido, "assignee", {"displayName"}, {"Responsável"}),
reporterExpandido = Table.ExpandRecordColumn(assigneeExpandido, "reporter", {"displayName"}, {"Repórter"}),
creatorExpandido = Table.ExpandRecordColumn(reporterExpandido, "creator", {"displayName"}, {"Criador"}),
resolutionExpandido = Table.ExpandRecordColumn(creatorExpandido, "resolution", {"name"}, {"Resolução"}),
issuetypeExpandido = Table.ExpandRecordColumn(resolutionExpandido, "issuetype", {"name"}, {"Tipo de Problema"}),

tabelaFinal = Table.RenameColumns(issuetypeExpandido, {
{"customfield_10121", "Nome da Campanha"},
{"customfield_10108", "Co_Campana"},
{"customfield_10136", "Data de lançamento ou envio"},
{"customfield_10107", "Área/segmentos da campanha"},
{"customfield_10110", "Data início campanha"},
{"customfield_10111", "Data fim campanha"},
{"customfield_10232", "Categoria"},
{"customfield_10114", "Materiais"},
{"customfield_10208", "Segmentos"},
{"customfield_10141", "Contemplar venda"},
{"customfield_10142", "Valor de Cliente"}
})
in
tabelaFinal

 

 

 

Thank you

1 answer

1 vote
Matteo Vecchiato
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2025

Hi @BARBARA EUSEBIO ,

Welcome to Atlassian community.

I guess the problem is related to deprecation of Api.
It is required to use the parameter nextPageToken; I sugget to get through this post: https://community.atlassian.com/forums/Jira-questions/Feature-change-during-CHANGE-2046/qaq-p/3103678 

Regards

Matthias Gaiser _K15t_
Community Champion
September 30, 2025

I'd back this answer by @Matteo Vecchiato

Here's the documentation about the API call you're calling and it doesn't contain startAt as parameter anymore.

BARBARA EUSEBIO
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 30, 2025

Hi @Matthias Gaiser _K15t_  and @Matteo Vecchiato 

Thanks for you fast feedback :)

Do you know if power bi supports that oarameter nextPageToken?

Thanks

Barbara

Matteo Vecchiato
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2025

Hi @BARBARA EUSEBIO ,

I know from other contacts that they manage to get the integration with Powerbi with the new api.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events