Open link in a new tab

Content

Expand project menu

api delete: 406 Missing content-type header, but header is present

Hello everyone,

I want to delete projects via the API project endpoint and have been struggling with the following problem: 

1. I send a DELETE request to the project end point api/v3/projects/<id>, where <id> is the id of the project I want to delete and that I queried before with an empty GET request to the end point api/v3/projects/. 
2. I receive the response [406], with the content 'Missing content-type header'. I however specified the header. 

My code looks like this:

import requests

delete_url = 'http://apikey:<apikey>@mysite.com/api/v3/projects/<id>'


headers = {'Content-type': 'application/json'}
response = requests.delete(delete_url, data={}, headers=headers, allow_redirects=True)

# this outputs: <Response [406]>
print(response)

response = response.content

# this outputs: b'Missing content-type header'
print(response)

It says that I am missing the content-type header but I specify it. The error [406] is not documented in https://www.openproject.org/docs/api/endpoints/projects/ 

Does anybody have any hint what's the problem?

Thank you and and a happy new year ! 
Julia