Forum Discussion
AssafHanina
01-17-2025Sisense Employee
Hey aditya ,
As mentioned by HamzaJ , it's seems that the Bearer is missing from the Authorization.
therefore, the error message is Unauthorized.
Please find an updated Sample script including the Bearer token
import requests
# define Variables
server = '' #format of https://my-sisense.sisense.com
token = ''
dashboard_oid = ''
widget_oid = ''
###
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
url = f'{server}/api/v1/dashboards/{dashboard_oid}/widgets/{widget_oid}'
# Send the request
response = requests.get(url=url, headers=headers)
print(response.status_code)
data = response.json()
print(data)
Best Regards