View Issue Details

IDProjectCategoryView StatusLast Update
0030415mantisbtapi restpublic2023-12-01 17:49
Reporteratrol Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version2.26.0Fixed in Version2.26.0 
Summary0030415: REST API: Add API to Get / Delete / Update versions
Description

Add support for deleting / updating versions via REST API

TagsNo tags attached.

Relationships

related to 0032445 closedvboctor REST API: Project Add API to return information about added version 
related to 0032832 closeddregad Remove version_cache_row()'s 2nd parameter 
related to 0032858 closeddregad Status codes returned by REST API delete operations are not consistent 
related to 0032909 closeddregad Internal application error when editing a Project Version. 
related to 0033374 closeddregad Erratic behavior of RestProjectVersionTest::testProjectUpdateVersion PHPUnit test case 

Activities

atrol

atrol

2022-05-28 11:32

developer   ~0066654

PR https://github.com/mantisbt/mantisbt/pull/1817

vboctor

vboctor

2023-04-22 19:55

manager   ~0067695

PR: https://github.com/mantisbt/mantisbt/pull/1883

dregad

dregad

2023-08-17 12:30

developer   ~0067998

As I reported in 0032832:0067996

Independently, I find it strange that RestProjectVersionTest::testProjectUpdateDoesNotExists expects a 204 (version deleted) and not a 404 (not found)

Proposed fix in PR https://github.com/mantisbt/mantisbt/pull/1905

Related Changesets

MantisBT: master c407d110

2023-04-22 04:20

vboctor


Details Diff
Implement VersionDeleteCommand

Fixes 0030415
Affected Issues
0030415
add - core/commands/VersionDeleteCommand.php Diff File

MantisBT: master c50890a0

2023-04-22 04:21

vboctor


Details Diff
Use VersionDeleteCommand in REST API

Fixes 0030415
Affected Issues
0030415
mod - api/rest/restcore/projects_rest.php Diff File

MantisBT: master 85abdf21

2023-04-22 04:21

vboctor


Details Diff
Use VersionDeleteCommand in SOAP API

Fixes 0030415
Affected Issues
0030415
mod - api/soap/mc_project_api.php Diff File

MantisBT: master 3f083387

2023-04-22 04:22

vboctor


Details Diff
Use VersionDeleteCommand in Web UI

Fixes 0030415
Affected Issues
0030415
mod - manage_proj_ver_delete.php Diff File

MantisBT: master a62cec0f

2023-04-22 04:55

vboctor


Details Diff
Implement VersionUpdateCommand

Fixes 0030415
Affected Issues
0030415
add - core/commands/VersionUpdateCommand.php Diff File

MantisBT: master fa1a9154

2023-04-22 04:55

vboctor


Details Diff
Update Web UI to use VersionUpdateCommand

Fixes 0030415
Affected Issues
0030415
mod - manage_proj_ver_update.php Diff File

MantisBT: master f9662472

2023-04-22 05:15

vboctor


Details Diff
Add REST API for updating a version

Fixes 0030415
Affected Issues
0030415
mod - api/rest/restcore/projects_rest.php Diff File

MantisBT: master ef791adc

2023-04-22 05:15

vboctor


Details Diff
Update SOAP API to use VersionUpdateCommand

Fixes 0030415
Affected Issues
0030415
mod - api/soap/mc_project_api.php Diff File

MantisBT: master 066c944f

2023-04-22 05:16

vboctor


Details Diff
Misc update for version APIs

Fixes 0030415
Affected Issues
0030415
mod - core/commands/VersionAddCommand.php Diff File
mod - core/commands/VersionDeleteCommand.php Diff File
mod - core/commands/VersionUpdateCommand.php Diff File
mod - manage_proj_ver_delete.php Diff File

MantisBT: master 1de2112c

2023-04-22 13:28

vboctor


Details Diff
Implement VersionGetCommand

Fixes 0030415
Affected Issues
0030415
add - core/commands/VersionGetCommand.php Diff File
mod - core/version_api.php Diff File

MantisBT: master f6c05947

2023-04-22 13:44

vboctor


Details Diff
Update VersionAddCommand to return the created version

Fixes 0030415
Affected Issues
0030415
mod - core/commands/VersionAddCommand.php Diff File

MantisBT: master 3805e332

2023-04-22 13:45

vboctor


Details Diff
Add REST API to get version(s) + return version on creation

Fixes 0030415
Affected Issues
0030415
mod - api/rest/restcore/projects_rest.php Diff File

MantisBT: master 5caafd27

2023-04-22 19:35

vboctor


Details Diff
Add test cases for project version APIs + fixes

Fixes 0030415
Affected Issues
0030415, 0033374
mod - api/rest/restcore/projects_rest.php Diff File
mod - core/commands/VersionAddCommand.php Diff File
mod - core/commands/VersionGetCommand.php Diff File
mod - core/commands/VersionUpdateCommand.php Diff File
mod - core/version_api.php Diff File
mod - manage_proj_ver_add.php Diff File
mod - manage_proj_ver_delete.php Diff File
mod - tests/core/RequestBuilder.php Diff File
mod - tests/rest/RestBase.php Diff File
add - tests/rest/RestProjectVersionTests.php Diff File

MantisBT: master 99f61e9b

2023-04-22 20:52

vboctor


Details Diff
Fix failing test

Fixes 0030415
Affected Issues
0030415
mod - api/soap/mc_project_api.php Diff File
mod - core/commands/VersionDeleteCommand.php Diff File
mod - tests/rest/AllTests.php Diff File
mod - tests/rest/RestProjectVersionTests.php Diff File
mod - tests/soap/VersionTest.php Diff File

MantisBT: master 4cdf5c7d

2023-04-22 23:46

vboctor


Details Diff
Fix indentation + php docs

Fixes 0030415
Affected Issues
0030415
mod - core/commands/VersionUpdateCommand.php Diff File
mod - core/version_api.php Diff File
mod - tests/rest/RestBase.php Diff File
mod - tests/rest/RestProjectVersionTests.php Diff File

MantisBT: master 3610ae50

2023-08-17 12:03

dregad


Details Diff
Exception when version to delete does not exist

The initial implementation of VersionDeleteCommand did not throw an
exception when given a non-existing version number, causing the REST API
to succeed with HTTP 204 (version deleted) when it should in fact have
failed.

The Command now throws a ClientException, resulting in the API returning
a 404 (not found) in this situation.

Note: the version_exists() call before retrieving the project id with
version_get_field() is not necessary, as the latter already perform this
check (via version_cache_row()).

PHPUnit test has been updated accordingly.

Fixes 0030415
Affected Issues
0030415
mod - core/commands/VersionDeleteCommand.php Diff File
mod - tests/rest/RestProjectVersionTest.php Diff File

MantisBT: master 69cc2cfc

2023-09-06 04:06

dregad


Details Diff
Bad timestamp in VersionGetCommand::VersionToArray()

Missing ApiObjectFactory::$soap = false initialization causes the
version's date_order to be initialized as a XSD_DATETIME SoapVar instead
of an ISO-formatted date string as expected.

As long as the PHP SOAP Extension is available, this does not cause any
actual side effects, because
- the return value is not used when the Commands are used from within
Mantis Core
- REST API initializes ApiObjectFactory::$soap = false so date_order is
returned in the correct format.

If the SOAP extension is not available, Mantis triggers an internal
application error when this function is called.

Fixes 0032909, 0030415
Affected Issues
0030415, 0032909
mod - core/commands/VersionGetCommand.php Diff File