Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

Web API Call with Header

  • 1.  Web API Call with Header

    Posted 19 days ago
    I am trying to connect Power BI to NOAA data - https://www.ncdc.noaa.gov/cdo-web/webservices/v2#gettingStarted

    I want to get a list of available locations for example: https://www.ncdc.noaa.gov/cdo-web/api/v2/locations

    I have requested a token and the instructions reference that the token has to be in the header, but I cannot figure out the proper way to get the header into the HTTP request header parameters.

    Any advice that can be provided is appreciated!

    ------------------------------
    Christy Miller
    2813565347
    Magnolia
    2813565347
    ------------------------------
    Power Summit (bi) - Post


  • 2.  RE: Web API Call with Header

    Silver Contributor
    Posted 16 days ago
    Christy -- Insert your token value within the token step below:

    let
        token = "<your token here>",
        endpoint = "locations",
        baseUrl = "https://www.ncdc.noaa.gov/cdo-web/api/v2/",
        url = Text.Combine({baseUrl,endpoint}),
        limit = 1000, // Defaults to 25, maximum is 1000.
        request = Web.Contents(
            url,
            [
                Headers = [
                    token = token
                ],
                Query = [
                    limit = Text.From(limit)
                ]
            ]
        ),
        requestData = Json.Document(request),
        metadata = requestData[metadata],
        results = requestData[results],
        #"Converted to Table" = Table.FromRecords(results)
    
    in
        #"Converted to Table"


    Tony



    ------------------------------
    Tony McGovern
    co-Founder & Data Scientist
    Emdata Inc.
    ------------------------------

    Power Summit (bi) - Post


  • 3.  RE: Web API Call with Header

    Posted 8 days ago
    Is this something that you are putting in DAX as a table?

    ------------------------------
    Christy Miller
    2813565347
    Magnolia
    2813565347
    ------------------------------

    Power Summit (bi) - Post


  • 4.  RE: Web API Call with Header

    Posted 7 days ago
    To get a full understanding of how to work with APIs in PowerQuery, you should watch Chris Webb's video here
    He has also written several excellent posts on his blog on how to work with web services.here and  here.
    Hope this will help.

    ------------------------------
    Bertrand d'Arbonneau
    ------------------------------

    Power Summit (bi) - Post