Hello team,
I'm pulling JIRA incidents into power BI via rest API that connects to created filter in Atlassian/Jira.
It worked nice with REST API v2 endpoint, but with the new one V3 I have issues and was hoping that someone can help me to solve them.
First problem I encountered was that API call was not working when simply replaced 2 to 3, I solved this by using this combination: rest/api/3/search/jql?jql instead of rest/api/3/search/jql.
The 2nd issue I got was that output returned was not identical. but I have solved that as well.
Last one that I have and still not being able to solve is getting all results from the filter.
I have created logic in my query that collects all results from the first page (100) checks the next page token and moves to the next one until there is no more. At least that is how I wanted to work, but what I actually get is a loop that returns the same 100 results from the first page. I have read that there is a bug reported for this but would appreciate if someone could provide a workaround.
Thanks.
The pagination behavior in v3 changed
Try using the startAt parameter instead of relying on nextPage, for example:
/rest/api/3/search?jql=filter=12345&startAt=100
Loop until isLast is true.
That usually avoids the duplicate-page issue with Power BI connectors.
Hello @Dejan Stajic
Please ignore the advice that @Ignacio Vera just gave to you:
Try using the startAt parameter instead of relying on nextPage, for example:
/rest/api/3/search?jql=filter=12345&startAt=100
as the API endpoint they cited does not exist any more, so it's impossible for you to use it in the manner they have described.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Dejan Stajic
I have read that there is a bug reported for this
Can you provide a link to where you read that or where that bug has been reported. There was a bug related to the nextPage token length when the endpoint first came out, but that was fixed ages ago.
If I had to guess, it's more likely that:
Just use your API test tool to validate the functionality of the endpoint and your requests, thereby isolating if the fault is in your code or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the link for the case: [JRACLOUD-94632] The nextPageToken parameter not works on the initial request for the JQL enhanced search (GET) API endpoint - Create and track feature requests for Atlassian products.
Here is a snip that shows how I'm trying to get other pages:
GetPage = (startAt as number) =>
Json.Document(
Web.Contents(
domain & "/rest/api/3/search/jql?jql=filter=" & filterId & "&fields=*all&startAt=" & Number.ToText(startAt) & "&maxResults=" & Number.ToText(maxResults),
[Headers=[Authorization=authKey]]
)
)[issues],
FirstPage = Json.Document(
Web.Contents(
domain & "/rest/api/3/search/jql?jql=filter=" & filterId & "&fields=*all&startAt=0&maxResults=" & Number.ToText(maxResults),
[Headers=[Authorization=authKey]]
)
),
AllIssues = List.Combine(
List.Generate(
() => [i = 0, issues = GetPage(0)],
each List.Count([issues]) > 0,
each [i = [i]+1, issues = GetPage([i]*maxResults)],
each [issues]
)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Dejan Stajic
The apparent bug that was reported in [JRACLOUD-94632] has nothing to do with the problem you are claiming to have.
IMHO that bug has been marked as Closed for a very good reason; the person who submitted that supposed bug simply mis-interpreted the API documentation and then rushed to a conclusion that what they experienced was a bug... when it was just them doing something wrong... they tried to submit a request with the nextToken parameter set to null, which will not work!
Again, I recommend that you use an API test tool like Postman to validate your request and all the parameter you are using. Don't guess... TEST!
PS. In you code I can see at least one major mistake. You have declared startAt=0. The topic of attempting to use the old startAt parameter with the new JQL search endpoints has been discussed many, many, many times on this forum and elsewhere for more than six months and I continue to be amazed at how many people are simply ignoring or not researching or reading the vast amounts of documentation about the totally different pagination mechanism of the new endpoints and why using the startAt parameter with the new JQL search endpoints is utterly futile and will not work!!
I recommend that you search this forum and / or do a simple Google search on the topic of the new JQL search endpoints to advise yourself of how to use them properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.