I am not able to export an Offers File when I try to fetch it via Python Code. I am trying to use the Bol. com API V9 and request a list of all offers.
headers = {
'Accept': 'application/vnd.retailer.V9+json',
"Content-Type": 'application/vnd.retailer.V9+json',
"Authorization": "Bearer " + f"{access_token}"
}
params = {
"format": "CSV",
}
url = "https://api.bol.com/retailer/offers/export"
response = requests.post(url, headers=headers, params=params)
Do you have an idea what I am missing out? Or is their API just buggy at this point? The POST Call gives me a result which looks like that:
Status-Code: 400 { "type" : "https://api.bol.com/problems", "title" : "Bad Request", "status" : 400, "detail" : "The supplied accept header media type is not supported.", "host" : "Instance-106", "instance" : "https://api.bol.com/retailer/offers/export?format=CSV" }
IMO the "Accept" Header looks absolutely fine according to their documentation.
Based on their documentation (found here) the server accepts data in Json format. So the correct code should look like:
headers = {
'Accept': 'application/vnd.retailer.V9+json',
"Content-Type": 'application/vnd.retailer.V9+json',
"Authorization": "Bearer " + f"{access_token}"
}
params = {
"format": "CSV",
}
url = "https://api.bol.com/retailer/offers/export"
response = requests.post(url, headers=headers, json=params) # <-- note the json= parameter