Forum Discussion

Luka2893's avatar
Luka2893
Regular Visitor
2 years ago
Solved

Power Query API request URL error in Excel

Hello, I am trying to connect Excel 2021 spreadsheet with data from BIS (Bank of International Settlements) database. They have API key builder. I retrieved the URL and put in Excel Power Query but ...
  • OwenAuger's avatar
    2 years ago

    Hi Luka2893 

     

    I tinkered around a bit and came up with this (.xlsx attached too):

    let
      apiCall = Web.Contents(
        "https://stats.bis.org/api/v1",
        [
          RelativePath = "data/BIS,WS_CBPOL_M,1.0/M.JP/all"
          //Query        = [startPeriod = "1960", endPeriod = "2023", detail = "full"]
        ]
      ),
      #"Imported XML" = Xml.Tables(apiCall, null, 65001),
      #"Navigation: Table" = #"Imported XML"{1}[Table],
      #"Navigation: Namespace" = #"Navigation: Table"{0}[#"Namespace:"],
      #"Navigation: Series" = #"Navigation: Namespace"{0}[Series],
      #"Navigation: Obs" = #"Navigation: Series"{0}[Obs],
      #"Changed Type" = Table.TransformColumnTypes(
        #"Navigation: Obs",
        {
          {"Attribute:TIME_PERIOD", type date},
          {"Attribute:OBS_VALUE", type number},
          {"Attribute:OBS_STATUS", type text},
          {"Attribute:OBS_CONF", type text}
        }
      ),
      #"Rename Columns" = Table.TransformColumnNames(#"Changed Type", each Text.AfterDelimiter(_, ":"))
    in
      #"Rename Columns"

     

    • I compared with some examples and WS_CBPOL_M seemed to be the required format.
    • You can optionally include Query parameters, but I commented them out (add a comma before the Query field if you do this).
    • The steps from "Imported XML" onwards may need to be tweaked.

    Does this help with what you were trying to do?

     

    Regards

    Owen