View Issue Details

IDProjectCategoryView StatusLast Update
0025688mantisbtapi restpublic2019-04-21 02:53
ReporterMaurycy Assigned Tocommunity  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.19.0 
Target Version2.21.0Fixed in Version2.21.0 
Summary0025688: Inconsistent naming of username field in REST API
Description

When creating the user via API we define user name in field username, but when API return the user object by eg. /api/rest/users/me the user name is in field name.

IMHO it should be everywhere username.

TagsNo tags attached.

Activities

dregad

dregad

2019-04-11 10:19

developer   ~0061887

I confirm that the payload's field name is not consistent with the one returned in the API's body.

However, please consider that MantisBT APIs (both SOAP and REST) have been using name instead of username in this context since release 1.1.0a4 (2007), and I don't think such inconsistency is worth breaking backwards-compatibility.

Maybe @vboctor will care to comment.

Maurycy

Maurycy

2019-04-11 11:17

reporter   ~0061891

For it to be username was obvious to me (I started with API creating user) but if it will break backwards-compatibility you can use name - just to be consistent.

vboctor

vboctor

2019-04-13 02:51

manager   ~0061919

Looks like we use name when returning issues and logged in user. So the create operation is what is not consistent. username makes sense, but name is used for other entities like statuses, versions, view_states, categories, etc.

Hence, I suggest the fix would be that user create accepts both name and username. If both are specified, then use name.

Maurycy

Maurycy

2019-04-15 02:51

reporter   ~0061934

That's ok with me ;-)

Maurycy

Maurycy

2019-04-16 09:19

reporter   ~0061944

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

Related Changesets

MantisBT: master 9baef465

2019-04-16 05:05

Maurycy13

Committer: vboctor


Details Diff
Fixes 0025688 - Inconsistent naming of username field in REST API. Affected Issues
0025688
mod - core/commands/UserCreateCommand.php Diff File