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 09:05:55

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

Issue History

Date Modified Username Field Change
2019-04-11 06:22 Maurycy New Issue
2019-04-11 10:19 dregad Status new => acknowledged
2019-04-11 10:19 dregad Note Added: 0061887
2019-04-11 11:17 Maurycy Note Added: 0061891
2019-04-13 02:51 vboctor Note Added: 0061919
2019-04-15 02:51 Maurycy Note Added: 0061934
2019-04-16 09:19 Maurycy Note Added: 0061944
2019-04-18 18:45 vboctor Changeset attached => MantisBT master 9baef465
2019-04-18 18:45 vboctor Assigned To => vboctor
2019-04-18 18:45 vboctor Status acknowledged => resolved
2019-04-18 18:45 vboctor Resolution open => fixed
2019-04-18 18:45 vboctor Fixed in Version => 2.21.0
2019-04-19 05:06 atrol Assigned To vboctor => community
2019-04-19 05:06 atrol Target Version => 2.21.0
2019-04-21 02:53 vboctor Status resolved => closed