'Using Put request for ScienceDirect API

I am having trouble using the ScienceDirect API and looking for help. Before I used the API with a requests.get and everything worked just fine. Due to some alternations on my search string I am forced to use the put-method (their API support told me so).

This is my code:

headers = {}
headers['Accept']='application/json'
headers['X-ELS-APIKey'] = 'my Api code here'
headers['X-ELS-Insttoken'] = 'my institutional token here'
headers['Content-Type'] = 'application/json'


data = {
        'qs':'("blockchain" OR "distributed ledger" OR "DLT") AND ("circular economy" OR "sustainable supply chain“)',
       'offset': 0
       } 

Url = "https://api.elsevier.com/content/search/sciencedirect"

r = requests.put(Url, data =json.dumps(data), headers=headers)

print(r.url)

I followed the documentation here: https://dev.elsevier.com/documentation/ScienceDirectSearchAPI.wadl When I run this code I receive the error message

{"service-error":{"status":{"statusCode":"AUTHENTICATION_ERROR","statusText":"No APIKey provided for request"}}}

My apiKey and the institutional token are correct and as I see it submit them in the header. Do you have any idea why this error occurs? Am I submitting the header somehow incorrect?

Thanks in advance for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source