Forum Discussion
Connecting Jira to Power BI using the Web API
- Anonymous6 years ago
Hi Mike282 ,
It seems like you are trying to stored web connector result in BASEURL parameters. (obviously, it require to stored your rest API link instead of web.contents result)
let BaseUrl = "https://companyname.atlassian.net/rest/api/3/search?jql=project in ('TEST')", JiraIDPerPage = 1000, GetJson = (Url) => let RawData = Web.Contents(Url,[Headers=[Authorization="Basic " & Credentials]]), Json = Json.Document(RawData) in Json, GetJiraIDCount = () => let Url = BaseUrl & "&maxResults=0", Json = GetJson(Url), Count = Json[#"total"] in Count, GetPage = (Index) => let Skip = "&startAt=" & Text.From(Index * JiraIDPerPage), Top = "&maxResults=" & Text.From(JiraIDPerPage), Url = BaseUrl & Skip & Top, Json = GetJson(Url), Value = Json[#"issues"] in Value, JiraIDCount = List.Max({ JiraIDPerPage, GetJiraIDCount() }), PageCount = Number.RoundUp(JiraIDCount / JiraIDPerPage), PageIndices = { 0 .. PageCount - 1 }, Pages = List.Transform(PageIndices, each GetPage(_)), JiraID = List.Union(Pages), Table = Table.FromList(JiraID, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(Table, "Column1", {"id", "key", "fields"}, {"Column1.id", "Column1.key", "Column1.fields"}) in #"Expanded Column1"BTW, you can take a look at following link about getting more than 50 results from Jira rest API:
PowerBI content pack only pulling 50 rows from API
Regards,
Xiaoxin Sheng
Hi Xiaoxin,
When I use this way, I always fail to get data.
Error Message is "Expression.Error: Access to the resource is forbidden."
How can I fix this?Thank you in advance.
Regards,
Kelly
Hi Kelly_Zhu,
I think you get this message due you are using the basic authentication with password. It seems that JIRA is not allowing basic authentication with password any more...
Link to deprecation notice: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/?_ga=2.7221810.1658349988.1579544538-2134642138.1579544538
Now, you can use an API key (https://confluence.atlassian.com/cloud/api-tokens-938839638.html ) instead of the password. You must encode base 64 email:APIKey.
Regards!
Pablo Barrachina
- trangvo5 years agoFrequent Visitor
Hello pablobarrachina,
Could I do the same way for JIRA server? I tried but got the error :
Expression.Error: The name 'Credentials' wasn't recognized. Make sure it's spelled correctly.
Any suggestion please.
Thank you in advance.