Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Laila92
Helper V
Helper V

connecting Powerbi and Jira from M

Hi, I tried looking ina  few topics like :https://community.powerbi.com/t5/Desktop/Connecting-Jira-to-Power-BI-using-the-Web-API/td-p/838130

 

But i can not get my code to work.

 

What I have is below:

let 
    BaseUrl = "https://autoleadstar.atlassian.net/rest/api/2/issue/createmeta",
    Credentials = "XXXX@email.com:My_token",
    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
    Table

I get the following error: 
"We couldn't authenticate with the credentials provide. Please try again."

 

Any tips on how to proceed?

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Laila92 

From your code I think you want to use a REST API as a data source.

Please check whether your access token is correct.

...
Credentials = "XXXX@email.com:My_token",
...
etJson = (Url) =>
        let 
            RawData = Web.Contents(Url,[Headers=[Authorization="Basic " & Credentials]]),

You can try to use web connector in Power BI to connect to your data source. You can add your authentication and other parameters you need in HTTP request header parameters in Advancd.

1.png

For reference: Using a REST API as a data source

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
ltopchyi
Helper III
Helper III

Hi @Laila92 

You can consider using Power BI Connector for Jira as one more way to solve your issue.

Liubov

Laila92
Helper V
Helper V

I was able to connect, but am only getting an empty table back. Any idea why that is?

v-rzhou-msft
Community Support
Community Support

Hi @Laila92 

From your code I think you want to use a REST API as a data source.

Please check whether your access token is correct.

...
Credentials = "XXXX@email.com:My_token",
...
etJson = (Url) =>
        let 
            RawData = Web.Contents(Url,[Headers=[Authorization="Basic " & Credentials]]),

You can try to use web connector in Power BI to connect to your data source. You can add your authentication and other parameters you need in HTTP request header parameters in Advancd.

1.png

For reference: Using a REST API as a data source

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.