Skip to content

Added #16956: API Endpoint to Retrieve Current Snipe-IT Version #16957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

NebelKreis
Copy link
Contributor

Description

This PR introduces a new API endpoint /settings/version that allows clients to retrieve the currently installed Snipe-IT version.
The goal is to support automated update workflows and reduce the need for manual version checks.
This feature is especially useful for system administrators and integration scripts that need to validate or report the current installation state before applying updates or triggering other actions.

Key Features:

  • Created a new controller to handle version retrieval logic.
  • Added a new API route under the settings namespace:
    GET /api/v1/settings/version
  • The endpoint returns the current version in JSON format.

Fixes #16956

Attached below is an example of how the resulting output would look like:

postman

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update (API Explorer)

How Has This Been Tested?

The implementation has been tested through the following methods:

  • Manual API call: Verified that the version is returned correctly via a GET request to /api/v1/settings/version.
  • Header validation: Ensured the response uses the correct Content-Type: application/json.

Test Configuration:

  • PHP version: 8.3.6
  • MySQL version: 10.6.4
  • Webserver version: Apache 2.4.58
  • OS version: Ubuntu 24.04

Checklist:

@NebelKreis NebelKreis requested a review from snipe as a code owner May 16, 2025 10:48
@snipe
Copy link
Member

snipe commented May 19, 2025

I think we already have a version endpoint.

snipe-it/routes/api.php

Lines 1323 to 1328 in 8a44144

Route::get('/version', function () {
return response()->json(
[
'version' => config('version.app_version'),
], 200);
}); // end version api routes

Copy link
Member

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this! But @snipe is right - we do already have this - but that being said, I'm totally fine with adding the additional information that you wanted - if you can add it to the existing endpoint in-line with the version that we're already returning, we'll be happy to take it. Thank you!

@NebelKreis
Copy link
Contributor Author

You’re right, I totally overlooked this, but I’ve made the changes now, so it should be all good.

Copy link
Member

@snipe snipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can pull that new controller tho?

@NebelKreis
Copy link
Contributor Author

It depends on what we want to implement in this API endpoint later on, but I can remove it for now if necessary.

@snipe
Copy link
Member

snipe commented May 22, 2025

It depends on what we want to implement in this API endpoint later on

I'm not sure what you mean. The API endpoint already exists, you're just adding more data to it.

@NebelKreis NebelKreis requested a review from snipe May 26, 2025 11:39
'parameters' => ['setting' => 'setting_id'],
]
); // end settings API
)->name('api.settings.backups.download');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this? We don't allow updating most of the settings via API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants