View Issue Details

IDProjectCategoryView StatusLast Update
0034578mantisbtapi restpublic2026-11-21 10:44
Reporterctabin Assigned Tocommunity  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.26.2 
Target Version2.29.0Fixed in Version2.29.0 
Summary0034578: API - allow access to obsolete/inherited versions
Description

Hello,

Currently, once a version has been marked as Obsolete, it is not possible to access it through the REST-JSON API, since only the active versions are returned.
It would be useful to add some parameters (for instance obsolete=true and inherited=true) in the request URL so the client can explicitly choose to received them in the response.

Additional Information

A first basic proposal was made in this PR without parameters.

TagsNo tags attached.

Activities

dregad

dregad

2024-08-14 02:05

developer   ~0069094

As mentioned in the PR review, the proposed basic fix is not acceptable as it would break backwards compatibility. A revised version of the code including a parameter is required. Feel free to ask if you need guidance.

dregad

dregad

2024-11-01 04:19

developer   ~0069419

Unassigning, as PR author does not have time to finalize it
https://github.com/mantisbt/mantisbt/pull/2019#issuecomment-2451025409

dombn

dombn

2026-11-10 15:07

reporter   ~0071591

I picked this up and submitted a revised fix addressing the review comments from PR 2019: https://github.com/mantisbt/mantisbt/pull/2313

The released, obsolete and inherit query parameters are only passed on when present, so the default behavior of GET /projects/{id}/versions is unchanged (released stays ternary when omitted). VersionGetCommand is untouched. The parameters are also documented in the OpenAPI definition.

dregad

dregad

2026-11-11 06:29

developer   ~0071592

Thanks for taking over @dombn. I'll review the PR as soon as I can (I'm quite busy these days and the backlog of things to do keeps growing...)

Related Changesets

MantisBT: master 84c82397

2026-11-21 10:44

dombn

Committer: community


Details Diff
Allow filtering project versions in REST API

GET /projects/{id}/versions ignored the released, obsolete and inherit
query parameters, although VersionGetCommand supports them. Obsolete
versions could therefore not be retrieved via the REST API at all.

Parameters are only passed on to the command when present, so the
default behavior is unchanged and released keeps its "all versions"
state when omitted. Values are converted with gpc_string_to_bool(),
since version_get_all_rows() checks obsolete with === false and a raw
"0" string would otherwise include obsolete versions. Non-scalar
values are rejected with HTTP 400.

Also documents the parameters in the OpenAPI definition and adds REST
tests for the obsolete and released filters.

Fixes 0034578, PR https://github.com/mantisbt/mantisbt/pull/2313
Affected Issues
0034578
mod - api/rest/mantisbt_openapi.yaml Diff File
mod - api/rest/restcore/projects_rest.php Diff File
mod - tests/rest/RestProjectVersionTest.php Diff File