REST API documentation for user management needs improvements

XMLWordPrintable

    • 0
    • 4

      Problem Definition

      API Documentation for the user management REST APIs are not well documented.

      POST to /admin/groups, /admin/users, admin/groups/$groupname/add-users does not include an acceptable request representation or parameters so it's difficult to know which parameters need to be included. Example:

      Suggested Solution

      acceptable request representations:

      application/json (groups)

      {
           "name": "new_group"
      }
      

      application/json (users)

      {
           "name": "new_user",
           "fullName": "full name",
           "email": "user@atlassian.com",
           "password": "password",
           "passwordConfirm": "password"
      }
      

      application/json (add-users)

      ["user1","user2"]
      

      Workaround

      For a better idea on how to use these APIs, see the curl examples included below:

      curl --user bamboo-admin:password -H "Content-Type: application/json" -X POST http://bamboo:8085/rest/api/latest/admin/groups --data '{
           "name": "new_group"
       }'
      
      curl --user bamboo-admin:password -H "Content-Type: application/json" -X POST http://bamboo:8085/rest/api/latest/admin/users --data '{
           "name": "new_user",
           "fullName": "full name",
           "email": "user@atlassian.com",
           "password": "password",
           "passwordConfirm": "password"
       }'
      
      curl --user bamboo-admin:password -H "Content-Type: application/json" -X POST http://bamboo:8085/rest/api/latest/admin/groups/$GROUPNAME/add-user --data '["user1","user2"]'
      
      -- set group permission to given  project
      curl -k -u bamboo-admin:password \
           -H 'Content-type: application/json' \
           -H 'Accept: application/json' \
           -d '["READ","CREATE","ADMINISTRATION"]' \
           -X PUT http://bamboo:8085/rest/api/latest/permissions/project/$PROJECTKEY/groups/$GROUPNAME
      
      -- set global permissions for given group
      curl -k -u bamboo-admin:password \
           -H 'Content-type: application/json' \
           -H 'Accept: application/json' \
           -d '["READ","CREATE","ADMINISTRATION","RESTRICTEDADMINISTRATION","CREATEREPOSITORY"]' \
           -X PUT http://bamboo:8085/rest/api/latest/permissions/global/groups/$GROUPNAME
      

            Assignee:
            Alexey Chystoprudov
            Reporter:
            Jeremy Owen
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: