Python Forum

Full Version: Bundesbank API Problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

So far I'm 0/2 on APIs. I am a beginner but I keep running into problems with APIs.

The German Bundesbank provides an API and the documentation. They clearly write out how to make an API request https://www.bundesbank.de/en/statistics/...rface-data and so I take the flowRef and key from here https://www.bundesbank.de/dynamic/action...0.R.I&id=0 and this is what I get:

url = 'https://api.statistiken.bundesbank.de/rest'
params = {
    'flowRef':'BBKRT',
    'key':'M.DE.Y.P.PC1.PC100.R.I',
}

req = requests.get(url, params=params)
But for whatever reason I get a 404 and I don't know why. In this service page https://api.statistiken.bundesbank.de/do...umentation where you can manually write out the get requests when I use the flowRef and key, it locates the data but it gives me 404 when I do it on python.

I'm sure this is an easy fix for anyone with experience in using APIs. I would appreciate the help.

Matt
import requests
	
flow_ref ='BBKRT'
key = 'M.DE.Y.P.PC1.PC100.R.I'

req = requests.get(f'https://api.statistiken.bundesbank.de/rest/data/{flow_ref}/{key}')
print(req.text)
req.text is a XML
Thank you. That did the trick.