Get Version of Installed NetBox Through API #3913

Closed
opened 2025-12-29 18:32:02 +01:00 by adam · 5 comments
Owner

Originally created by @CSimpiFoN on GitHub (Jul 29, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.8.8

Proposed Functionality

API endpoint to get the currently installed version

Use Case

  • Be able to make deployment automation to decide if the latest version is already installed
  • Be able to make to create new version check automation and alerting if new version is available

Database Changes

N/A

External Dependencies

N/A

Originally created by @CSimpiFoN on GitHub (Jul 29, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.9 * NetBox version: 2.8.8 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality API endpoint to get the currently installed version <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case - Be able to make deployment automation to decide if the latest version is already installed - Be able to make to create new version check automation and alerting if new version is available <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes N/A <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies N/A
adam added the status: acceptedtype: feature labels 2025-12-29 18:32:02 +01:00
adam closed this issue 2025-12-29 18:32:02 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2020):

I should note that the API version is passed as the API-Version HTTP header value in every response, however this does not convey the full NetBox version. (For example, the API version for NetBox v2.8.7 is 2.8.)

Does it make sense to create an endpoint specifically for this? If we go that route, I imagine there's probably other information we'd want to return as well; maybe a status endpoint or something to that effect?

Another option would be to replicate/replace the API-Version header with e.g. NetBox-Version and include it with every response. This could easily supersede the API version header (since it contains the same information), but that would be a fairly disruptive change for existing clients so we'd need to support both in parallel for some time.

@jeremystretch commented on GitHub (Jul 29, 2020): I should note that the _API version_ is passed as the `API-Version` HTTP header value in every response, however this does not convey the full NetBox version. (For example, the API version for NetBox v2.8.7 is 2.8.) Does it make sense to create an endpoint specifically for this? If we go that route, I imagine there's probably other information we'd want to return as well; maybe a `status` endpoint or something to that effect? Another option would be to replicate/replace the `API-Version` header with e.g. `NetBox-Version` and include it with every response. This could easily supersede the API version header (since it contains the same information), but that would be a fairly disruptive change for existing clients so we'd need to support both in parallel for some time.
Author
Owner

@sdktr commented on GitHub (Aug 3, 2020):

The header in API -calls is mostly relevant to instruct clients which version to use while rendering the output, right? Assuming there will be breaking API changes only between major release a full version would be redundant?

Maybe a separate 'environment' endpoint is the cleanest option. Besides the netbox version it could expose detailed version info of dependencies that might end up being inspected on startup as well (https://github.com/netbox-community/netbox/issues/4933)? There's the upgrade notification (https://github.com/netbox-community/netbox/issues/738) that fits into this type of information as well?

@sdktr commented on GitHub (Aug 3, 2020): The header in API -calls is mostly relevant to instruct clients which version to use while rendering the output, right? Assuming there will be breaking API changes only between major release a full version would be redundant? Maybe a separate 'environment' endpoint is the cleanest option. Besides the netbox version it could expose detailed version info of dependencies that might end up being inspected on startup as well (https://github.com/netbox-community/netbox/issues/4933)? There's the upgrade notification (https://github.com/netbox-community/netbox/issues/738) that fits into this type of information as well?
Author
Owner

@CSimpiFoN commented on GitHub (Aug 18, 2020):

A status endpoint sounds nice that we can call for readiness/liveness too

@CSimpiFoN commented on GitHub (Aug 18, 2020): A status endpoint sounds nice that we can call for readiness/liveness too
Author
Owner

@jeremystretch commented on GitHub (Sep 1, 2020):

Marking this as tentatively accepted with the understanding that the implementation will take the form of a new "status" REST API endpoint, containing at minimum the running NetBox and Python versions. We may opt to add additional context such as installed dependencies, plugins, etc. but further consideration is needed.

@jeremystretch commented on GitHub (Sep 1, 2020): Marking this as tentatively accepted with the understanding that the implementation will take the form of a new "status" REST API endpoint, containing at minimum the running NetBox and Python versions. We may opt to add additional context such as installed dependencies, plugins, etc. but further consideration is needed.
Author
Owner

@jeremystretch commented on GitHub (Oct 13, 2020):

Example of the endpoint's current output:

{
    "django-version": "3.1",
    "installed-apps": {
        "cacheops": "5.0.1",
        "debug_toolbar": "2.2",
        "django_filters": "2.3.0",
        "django_prometheus": "2.0.0",
        "django_rq": "2.3.2",
        "django_tables2": "2.3.1",
        "drf_yasg": "1.17.1",
        "mptt": "0.11.0",
        "rest_framework": "3.11.0",
        "taggit": "1.3.0",
        "timezone_field": "4.0"
    },
    "netbox-version": "2.10-beta1",
    "plugins": {
        "netbox_animal_sounds": "0.1"
    },
    "python-version": "3.6.9",
    "rq-workers-running": 0
}

Please note that we're not taking any suggestions for changes at this time. Please wait to try the v2.10 beta to provide any feedback regarding this endpoint, as it may still change.

@jeremystretch commented on GitHub (Oct 13, 2020): Example of the endpoint's current output: ```json { "django-version": "3.1", "installed-apps": { "cacheops": "5.0.1", "debug_toolbar": "2.2", "django_filters": "2.3.0", "django_prometheus": "2.0.0", "django_rq": "2.3.2", "django_tables2": "2.3.1", "drf_yasg": "1.17.1", "mptt": "0.11.0", "rest_framework": "3.11.0", "taggit": "1.3.0", "timezone_field": "4.0" }, "netbox-version": "2.10-beta1", "plugins": { "netbox_animal_sounds": "0.1" }, "python-version": "3.6.9", "rq-workers-running": 0 } ``` Please note that we're not taking any suggestions for changes at this time. Please wait to try the v2.10 beta to provide any feedback regarding this endpoint, as it may still change.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3913