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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Trying to connect to an API

Hello!

I have been going through the various documentations and links already provided i nthe various other posts about this topic, mainly this one: Chris Webb's BI Blog: Working with Web Services in Power Query Chris Webb's BI Blog (crossjoin.co.uk...

I keep getting an error message to which I do not have the knowledge to solve myself. I still new to Power BI.

 

When I make a custom query in the PQE with this format:
= Web.Contents("https://www.devstack.vwgroup.com/jira/secure/BOARDNAMEHERE",
[Query=[ #"filter"="", #"orderBy"=""],
ApiKeyName=[#"APIToken" ="APIKEYHERE"] ])

I get the following error:

Spartan_0-1673947144350.png

The token is made of numbers and text.

How can I solve this?

1 ACCEPTED SOLUTION
Daryl-Lynch-Bzy
Community Champion
Community Champion

Hi @Anonymous - I start by creating an API token following these instuctions:  Manage API tokens for your Atlassian account | Atlassian Support.  When it comes to using the Token, there are two options for extracting JIRA data:

  • Download the CSV for Filters by using the Link.

DarylLynchBzy_0-1674030972146.png

 

 

DarylLynchBzy_1-1674030984891.png

 

let
    Source = 
        Csv.Document(
            Web.Contents("https://######.atlassian.net/sr/jira.issueviews:searchrequest-csv-all-fields/{id####}/SearchRequest-{id####}.csv"),
            [Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]
        ),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
    #"Promoted Headers" 

Note this example would store a data source connection for the fully specified csv file url.  You can make this relative path.

DarylLynchBzy_3-1674031927631.png

This provide a big flat csv table with single row for each issue.  While this is good, it is not great for columns with multiple values.  If you have 3 watchers for example, there will be 3 columns (watcher, watcher2, watcher3).

 

This is an example for the API call.

 

let
    #"JIRA Rest API URL Path" = "https://######.atlassian.net/rest/api/3/",
    #"Relative Path" = "/project/search",
    #"Max Results Per API Call" = 50,
    #"Initial API Call" = Web.Contents(
            #"JIRA Rest API URL Path",
            [
                RelativePath=#"Relative Path", 
                Headers=[Accept="application/json"], 
                Query=[startAt="0"]
            ]
        ),
    #"Open Initial API Call" = Json.Document(#"Initial API Call"),
    #"Get Total Items" = #"Open Initial API Call"[total],
    #"Number of API Calls" = Number.IntegerDivide(#"Get Total Items", #"Max Results Per API Call") + 1,
    #"Run API Calls" = 
    let
        #"Start At List" = List.Generate(() => 0, each _ < #"Number of API Calls" * 50 , each _ + 50 ),
        #"Call API" = List.Transform( #"Start At List" , each 
            Web.Contents(
                #"JIRA Rest API URL Path", 
                [
                    RelativePath=#"Relative Path", 
                    Headers=[Accept="application/json"], 
                    Query=[startAt=Text.From(_)]
                ])
            ),
        #"Open Json" = List.Transform( #"Call API" , each Json.Document(_) ),
        #"Get values" = List.Transform( #"Open Json" , each _[values] ),
        #"Get Lists" = List.Combine(#"Get values"),
        #"Converted to Table" = Table.FromList(#"Get Lists", Splitter.SplitByNothing(), type table[Records to Expand=Record.Type], null, ExtraValues.Error)
    in
        #"Converted to Table",

 

To use this call the following data source credentials are required for "https://######.atlassian.net/rest/api/3/"

DarylLynchBzy_2-1674031496068.png

 

View solution in original post

3 REPLIES 3
Daryl-Lynch-Bzy
Community Champion
Community Champion

Hi @Anonymous - I start by creating an API token following these instuctions:  Manage API tokens for your Atlassian account | Atlassian Support.  When it comes to using the Token, there are two options for extracting JIRA data:

  • Download the CSV for Filters by using the Link.

DarylLynchBzy_0-1674030972146.png

 

 

DarylLynchBzy_1-1674030984891.png

 

let
    Source = 
        Csv.Document(
            Web.Contents("https://######.atlassian.net/sr/jira.issueviews:searchrequest-csv-all-fields/{id####}/SearchRequest-{id####}.csv"),
            [Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]
        ),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
    #"Promoted Headers" 

Note this example would store a data source connection for the fully specified csv file url.  You can make this relative path.

DarylLynchBzy_3-1674031927631.png

This provide a big flat csv table with single row for each issue.  While this is good, it is not great for columns with multiple values.  If you have 3 watchers for example, there will be 3 columns (watcher, watcher2, watcher3).

 

This is an example for the API call.

 

let
    #"JIRA Rest API URL Path" = "https://######.atlassian.net/rest/api/3/",
    #"Relative Path" = "/project/search",
    #"Max Results Per API Call" = 50,
    #"Initial API Call" = Web.Contents(
            #"JIRA Rest API URL Path",
            [
                RelativePath=#"Relative Path", 
                Headers=[Accept="application/json"], 
                Query=[startAt="0"]
            ]
        ),
    #"Open Initial API Call" = Json.Document(#"Initial API Call"),
    #"Get Total Items" = #"Open Initial API Call"[total],
    #"Number of API Calls" = Number.IntegerDivide(#"Get Total Items", #"Max Results Per API Call") + 1,
    #"Run API Calls" = 
    let
        #"Start At List" = List.Generate(() => 0, each _ < #"Number of API Calls" * 50 , each _ + 50 ),
        #"Call API" = List.Transform( #"Start At List" , each 
            Web.Contents(
                #"JIRA Rest API URL Path", 
                [
                    RelativePath=#"Relative Path", 
                    Headers=[Accept="application/json"], 
                    Query=[startAt=Text.From(_)]
                ])
            ),
        #"Open Json" = List.Transform( #"Call API" , each Json.Document(_) ),
        #"Get values" = List.Transform( #"Open Json" , each _[values] ),
        #"Get Lists" = List.Combine(#"Get values"),
        #"Converted to Table" = Table.FromList(#"Get Lists", Splitter.SplitByNothing(), type table[Records to Expand=Record.Type], null, ExtraValues.Error)
    in
        #"Converted to Table",

 

To use this call the following data source credentials are required for "https://######.atlassian.net/rest/api/3/"

DarylLynchBzy_2-1674031496068.png

 

Daryl-Lynch-Bzy
Community Champion
Community Champion

Hi @Anonymous - could you please try the following options:

1. use this code:

= Web.Contents(
    "https://www.devstack.vwgroup.com/jira/secure/BOARDNAMEHERE",
    [ 
      Query=[ #"filter"="", #"orderBy"=""],
      Headers=[#"APIToken" = "APIKEYHERE"] 
    ]
)

 

2. Remove the API token from the Web.Contents altogether, so that it is included in the Data Source Connection as Web Api.

 

Out of interest, are you connecting to JIRA?  Your url includes JIRA but it does follow the normal convention.  I have used something like (https://xxxx.atlassian.com/).  When I use "Basic" authentication provide the Username and APIToken provide by JIRA.

 

Anonymous
Not applicable

Hi @Daryl-Lynch-Bzy,

thanks for the reply. 

 

Unfortunately when I try the above method I still get an Error: 

Spartan_0-1674029013178.png


But if you say that you have already achieved to connect to JIRA boards (without the connector from the marketplace) then I am very interested in how you did that!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.