API endpoint to retrieve a data file's content #9136

Closed
opened 2025-12-29 20:46:08 +01:00 by adam · 4 comments
Owner

Originally created by @Sh4d1 on GitHub (Jan 23, 2024).

NetBox version

v3.5.9

Feature type

Change to existing functionality

Proposed functionality

It would be nice to have a way to get a data file content from the API. It's currently only possible via the UI if I'm not mistaken.
A new API endpoint /data-file//content could be neat!

Use case

It can help systems using netbox to query interesting information from netbox to use for different things: pxe config, ...

Database changes

None?

External dependencies

None?

Originally created by @Sh4d1 on GitHub (Jan 23, 2024). ### NetBox version v3.5.9 ### Feature type Change to existing functionality ### Proposed functionality It would be nice to have a way to get a data file content from the API. It's currently only possible via the UI if I'm not mistaken. A new API endpoint /data-file/<id>/content could be neat! ### Use case It can help systems using netbox to query interesting information from netbox to use for different things: pxe config, ... ### Database changes None? ### External dependencies None?
adam added the type: feature label 2025-12-29 20:46:08 +01:00
adam closed this issue 2025-12-29 20:46:08 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 25, 2024):

IIRC we intentionally omitted file data from the API serializer because we didn't want it to be consumed as a file server.

It can help systems using netbox to query interesting information from netbox to use for different things: pxe config, ...

Can you think of a use case that's better served via proxy by NetBox than by accessing the file directly from its source?

@jeremystretch commented on GitHub (Jan 25, 2024): IIRC we intentionally omitted file data from the API serializer because we didn't want it to be consumed as a file server. > It can help systems using netbox to query interesting information from netbox to use for different things: pxe config, ... Can you think of a use case that's better served via proxy by NetBox than by accessing the file directly from its source?
Author
Owner

@llamafilm commented on GitHub (Feb 2, 2024):

I’m curious what you would use this for.
I do something similar with Telegraf config files. Netbox generates these files, and then they are served directly by Apache. I’m guessing serving them through Netbox would incur some performance penalty, and I’m not sure what the benefit would be?

@llamafilm commented on GitHub (Feb 2, 2024): I’m curious what you would use this for. I do something similar with Telegraf config files. Netbox generates these files, and then they are served directly by Apache. I’m guessing serving them through Netbox would incur some performance penalty, and I’m not sure what the benefit would be?
Author
Owner

@jeremystretch commented on GitHub (Feb 12, 2024):

As there's been no further justification offered for this change, I'm going to close it in accordance with the original intent of this feature's implementation.

@jeremystretch commented on GitHub (Feb 12, 2024): As there's been no further justification offered for this change, I'm going to close it in accordance with the original intent of this feature's implementation.
Author
Owner

@Sh4d1 commented on GitHub (Feb 12, 2024):

Sorry I apparently missed the first mails 😅

Can you think of a use case that's better served via proxy by NetBox than by accessing the file directly from its source?

It was more of a simple way to get git-synced files from an API, but I agree, it's not really Netbox-centric!

I’m curious what you would use this for.

It's a stateless DHCP/TFTP software based on Netbox as a source of truth, and I was thinking of for instance using the external data as backend for my PXE template files for instance

@Sh4d1 commented on GitHub (Feb 12, 2024): Sorry I apparently missed the first mails :sweat_smile: > Can you think of a use case that's better served via proxy by NetBox than by accessing the file directly from its source? It was more of a simple way to get git-synced files from an API, but I agree, it's not really Netbox-centric! > I’m curious what you would use this for. It's a stateless DHCP/TFTP software based on Netbox as a source of truth, and I was thinking of for instance using the external data as backend for my PXE template files for instance
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9136