Bug 41107 - Create an API endpoint to get Koha version
Summary: Create an API endpoint to get Koha version
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-27 13:28 UTC by Andrew Fuerste-Henry
Modified: 2025-12-09 18:59 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41107: Add /status/version API endpoint (12.97 KB, patch)
2025-11-05 14:39 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha (3.06 KB, patch)
2025-11-05 14:39 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41107: Add /status/version API endpoint (13.00 KB, patch)
2025-11-28 21:46 UTC, David Nind
Details | Diff | Splinter Review
Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha (3.10 KB, patch)
2025-11-28 21:46 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2025-10-27 13:28:11 UTC
It would be helpful to have an API endpoint from which to get the Koha version of a system
Comment 1 Tomás Cohen Arazi (tcohen) 2025-11-05 14:39:51 UTC
Created attachment 189072 [details] [review]
Bug 41107: Add /status/version API endpoint

Adds a new REST API endpoint to retrieve Koha version information.

This implementation includes:
- Koha::Status class for instance status information
- /status/version endpoint returning structured version data
- OpenAPI specification with koha_version definition
- REST controller for handling the endpoint

The returned version object includes:
- version: full version string (e.g., '25.06.00.029')
- major: major version number
- minor: minor version number
- release: major.minor version
- maintenance: major.minor.maintenance version
- development: development version (if applicable)

This prepares the foundation for a future /status endpoint that will
include all information displayed in the about page.

To test:
1. Apply the patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
3. Run the tests:
  k$ prove t/Koha/Status.t \
           t/db_dependent/api/v1/status.t
=> SUCCESS: Tests pass!
4. Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2025-11-05 14:39:54 UTC
Created attachment 189073 [details] [review]
Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha

This patch makes the template plugin used for rendering the Koha version
use the introduced method.

I did this checks:

```shell
cd koha-tmpl
git grep Koha.Version
```

The places Koha.Version is used, it is used as:

* `Koha.Version.maintenance`
* `Koha.Version.release`
* Assigned to a variable like this `SET koha_version = Koha.Version`

All occurences of the `koha_version` template variable are:

* `koha_version.development`
* `koha_version.major`
* `koha_version.minor`

This implies the newly added `.version` attribute has no undesired side
effects in templates.

Note: plugins-home.tt has a different use of a variable named the same,
which is unrelated.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/Koha_Template_Plugin_Koha.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 3 David Nind 2025-11-28 21:46:17 UTC
Created attachment 190029 [details] [review]
Bug 41107: Add /status/version API endpoint

Adds a new REST API endpoint to retrieve Koha version information.

This implementation includes:
- Koha::Status class for instance status information
- /status/version endpoint returning structured version data
- OpenAPI specification with koha_version definition
- REST controller for handling the endpoint

The returned version object includes:
- version: full version string (e.g., '25.06.00.029')
- major: major version number
- minor: minor version number
- release: major.minor version
- maintenance: major.minor.maintenance version
- development: development version (if applicable)

This prepares the foundation for a future /status endpoint that will
include all information displayed in the about page.

To test:
1. Apply the patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
3. Run the tests:
  k$ prove t/Koha/Status.t \
           t/db_dependent/api/v1/status.t
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-11-28 21:46:21 UTC
Created attachment 190030 [details] [review]
Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha

This patch makes the template plugin used for rendering the Koha version
use the introduced method.

I did this checks:

```shell
cd koha-tmpl
git grep Koha.Version
```

The places Koha.Version is used, it is used as:

* `Koha.Version.maintenance`
* `Koha.Version.release`
* Assigned to a variable like this `SET koha_version = Koha.Version`

All occurences of the `koha_version` template variable are:

* `koha_version.development`
* `koha_version.major`
* `koha_version.minor`

This implies the newly added `.version` attribute has no undesired side
effects in templates.

Note: plugins-home.tt has a different use of a variable named the same,
which is unrelated.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/Koha_Template_Plugin_Koha.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>