View Issue Details

IDProjectCategoryView StatusLast Update
0034683mantisbtapi restpublic2025-05-03 19:30
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version2.26.4Fixed in Version2.26.4 
Summary0034683: REST POST /issues allows creation of Issue when invalid Category is specified
Description

When calling the endpoint with a payload including an invalid Category and $g_allow_no_category = ON, the Issue is created successfully (HTTP 201) with an empty category.

The expected behavior would be an error (Category not found).

Steps To Reproduce

Set $g_allow_no_category = ON; in config_inc.php

Execute the request:

POST http://localhost/mantis/api/rest/issues/
Authorization: {{token}}
Content-Type: application/json

{
  "summary": "Test issue",
  "description": "Description",
  "category": "Non-existing",
  "project": {
    "id": 1
  }
}
TagsNo tags attached.

Relationships

related to 0026672 closeddregad mc_issue_add fails with "Object of class SoapFault could not be converted to int" 
related to 0035668 resolveddregad can't change issue category to "no category" via rest api 

Activities

Related Changesets

MantisBT: master-2.26 656f93ee

2024-09-20 20:38

dregad


Details Diff
REST: error when creating issue with invalid category

When calling the POST /issues endpiont with a payload including an
invalid Category and $g_allow_no_category = ON, the Issue was created
successfully (HTTP 201) with an empty category.

Changing the logic in mci_get_category_id() so that a ClientException
is thrown in this case.

Fixes 0034683
Affected Issues
0034683
mod - api/soap/mc_api.php Diff File

MantisBT: master f97ee460

2025-03-28 20:54

dregad


Details Diff
Fix regression in mci_get_category_id()

REST API was not allowing to unset the Category when updating an Issue
with $g_allow_no_category = ON with a payload `{"category": {"id": 0}}`.

Regression in mci_get_category_id() function, introduced by commit
656f93eebaf033f4b5bf34f17487db6346f12d8a (Issue 0034683).

Fixes 0035668
Affected Issues
0034683, 0035668
mod - api/soap/mc_api.php Diff File

MantisBT: master-2.27 01f3d24e

2025-04-20 12:20

dregad


Details Diff
Fix regression in mci_get_category_id()

REST API was not allowing to unset the Category when updating an Issue
with $g_allow_no_category = ON with a payload `{"category": {"id": 0}}`.

Regression in mci_get_category_id() function, introduced by commit
656f93eebaf033f4b5bf34f17487db6346f12d8a (Issue 0034683).

Fixes 0035668

Backported from master branch (cherry picked commits f97ee460815ff14b31462d1da0a48405d0acb363 and
1ccc4205e50c23d47009073d85423d29c4cae449).
Affected Issues
0034683, 0035668
mod - api/soap/mc_api.php Diff File