API returns empty list #8346

Closed
opened 2025-12-29 20:35:37 +01:00 by adam · 3 comments
Owner

Originally created by @grethler on GitHub (Jul 18, 2023).

NetBox version

v3.5.6

Python version

3.11

Steps to Reproduce

Use the following code with the link of your netbox instance and a token that has the right permissions to view:

import requests
TENANT = ""
TOKEN= ""

header = {"Authorization":TOKEN}
rep = requests.get(f"https://{TENANT}/api/extras/reports/", headers=header)

print(rep.json()

Expected Behavior

Return of json like in browser

Observed Behavior

Returns empty list

Originally created by @grethler on GitHub (Jul 18, 2023). ### NetBox version v3.5.6 ### Python version 3.11 ### Steps to Reproduce Use the following code with the link of your netbox instance and a token that has the right permissions to view: ``` import requests TENANT = "" TOKEN= "" header = {"Authorization":TOKEN} rep = requests.get(f"https://{TENANT}/api/extras/reports/", headers=header) print(rep.json() ``` ### Expected Behavior Return of json like in browser ### Observed Behavior Returns empty list
adam closed this issue 2025-12-29 20:35:37 +01:00
Author
Owner

@abhi1693 commented on GitHub (Jul 18, 2023):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.5.6. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@abhi1693 commented on GitHub (Jul 18, 2023): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.5.6. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@grethler commented on GitHub (Jul 18, 2023):

Problem must be some misconfiguration then.

@grethler commented on GitHub (Jul 18, 2023): Problem must be some misconfiguration then.
Author
Owner

@grethler commented on GitHub (Jul 19, 2023):

Solved the Problem by changing:
header = {"Authorization":TOKEN}
to
header = {"Authorization": f"Token {TOKEN}}"

@grethler commented on GitHub (Jul 19, 2023): Solved the Problem by changing: `header = {"Authorization":TOKEN}` to `header = {"Authorization": f"Token {TOKEN}}"`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8346