API GET Request | Access to the requested resource is forbidden

Hello,
when I am trying to integrate with the API, I am running in to some problems.
Both when i use CURL and get requests in python I get the following error:

{‘head’: {‘status’: 403, ‘ok’: False, ‘messages’: , ‘errors’: [‘Access to the requested resource is forbidden. Invalid User or Token’], ‘references’: {}}, ‘body’: {}}

My code looks like this (with XXXX and company_name filled out):

import requests

URL = “https://octave-api.sierrawireless.io/v5.0/<COMPANY_NAME>/device/?only=id,name”

user = ‘XXXX’
token = ‘XXXX’

PARAMS = {‘X-Auth-User’:user, ‘X-Auth-Token’: token}

r = requests.get(url = URL, params = PARAMS)

data = r.json()

print(data)

Hi @oliners

Please try with:

curl [https://octave-api.sierrawireless.io/v5.0/my_company/device/my_device_id] -H “X-Auth-User: xxx” -H “X-Auth-Token: xxx”

Help to tick “Solutions” if your question is answered.

Hi, thank you for your answer, but it is still not working for me.
I still get the following response : curl: (6) Could not resolve host

Do you knwo what this could be?

Hi @oliners

You are missing the device id parameter.

It works for me. I just hide sensitive information about user, token, company name and device ID.

import requests

url = “https://octave-api.sierrawireless.io/v5.0/COMPANY_NAME/device/DEVICE_ID/?only=id,name

payload = {}

headers = {

‘X-Auth-User’: ‘xxx’,

‘X-Auth-Token’: ‘xxx’

}

response = requests.request(“GET”, url, headers=headers, data = payload)

print(response.text.encode(‘utf8’))

Please help to tick “Solutions” if your question is answered.

1 Like