Currently trying to request a json using python but I keep getting a 401 error on response. When I use curl I receive the correct json data.
Curl I use:
curl -H "X-Samanage-Authorization: Bearer API_TOKEN" -H 'Accept: application/vnd.samanage.v2.1+json' -H 'Content-Type: application/json' -X GET https://api.samanage.com/incidents.json
Python that results in 401 error:
import json
import requests
response = requests.get('https://api.samanage.com/incidents.json', headers={'X-Samanage-Authorization': 'API_TOKEN'})
print(response.status_code)
headers={'X-Samanage-Authorization': 'Bearer API_TOKEN'}curlcommand you used is not the same as what you did in your python code. Doescurl -H "X-Samanage-Authorization: Bearer API_TOKEN" -X GET https://api.samanage.com/incidents.jsonreturn the correct result?