UserManagement REST API

From Gcube Wiki
Revision as of 15:20, 25 July 2013 by Luigi.fortunati (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Organization Management

Create organization

    PUT <root-uri>/userService/organizationmanager/{organizationName} 

Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
mandatory


HTTP Response:

Description:

HTTP Status Description
200 Created organization was created
400 Bad Request Invalid parameter or field names in the request.



Example:

Request:

    PUT <root-uri>/userService/organizationmanager/<organizationName> 
    Response:
    200 CREATED

Get organization

    GET <root-uri>/userService/organizationmanager/{organizationName} 
    Request Message Body:


Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
mandatory


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK Organization was present already
404 Not Found Organization was not present


Example:

Request:

    GET <root-uri>/userService/organizationmanager/<organizationName> 
    Response:
    HTTP/1.1 200 OK

Delete organization

    DELETE <root-uri>/userService/organizationmanager/{organizationName} 

Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
mandatory


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK organization was successfully deleted
404 Not Found Organization was not found
400 Bad Request Invalid parameter of field names in the request


Example:

Request:

    DELETE <root-uri>/userService/organizationmanager/<organizationName> 
    Response:
    200 DELETED

List organizations

    GET <root-uri>/userService/organizationmanager/organizations
    Content-Type: application/json


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK There was at least one organization
404 Not Found No organization was present


Example:

Request:

    GET <root-uri>/userService/organizationmanager/organizations
    Response:
    HTTP/1.1 200 OK
    Content-Type: application/json
    {“organizations”:[
     {“name”:“engineering”,”description”:”www.eng.it”},
     {“name”:”venus-c”,”description”:”www.venus-c.eu”}
    ]}

Delete organizations

    DELETE <root-uri>/userService/organizationmanager/organizations


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK organizations have been successfully deleted
404 Not Found No organization was present


Example:

Request:

     DELETE <root-uri>/userService/organizationmanager/organizations
    Response:
    HTTP/1.1 200 OK

Group Management

Create group

    PUT <root-uri>/userService/groupmanager/


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
organizationName
JSON String
Organization of the user
optional
description
JSON String
Group description
optional

HTTP Response:

Description:


HTTP Status Description
200 Created group was created
400 Bad Request Invalid parameter or field names in the request.

Example:

Request:

     PUT <root-uri>/userService/groupmanager/
    Content-Type: application/json
    {“groupName” : “itpeople”}
    Response:
    HTTP/1.1 200 CREATED

Get group by group name

    GET <root-uri>/userService/groupmanager/{groupName} 


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK Group was present already
404 Not Found Group was not present

Example:

Request:

    GET <root-uri>/userService/groupmamager/<groupName> 
    Response:
    HTTP/1.1 200 OK

Get group by group name and organization name

GET <root-uri>/userService/groupmanager/{groupName}/organization/{organizationName}


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
organizationName
JSON String
Name of the organization
mandatory


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK Group was present already
404 Not Found Group was not present


Example:

Request:

  GET <root-uri>/userService/groupmamager/<groupName>/organization/<organizationName>
  Response:
  HTTP/1.1 200 OK

List groups

    GET <root-uri>/userService/groupmanager/groups/{organizationName}
    Content-Type: application/json


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK There was at least one group
404 Not Found No group was present


Example:

Request:

    GET <root-uri>/userService/groupmanager/groups
    Response:
    HTTP/1.1 200 OK
    Content-Type: application/json
    {“groups”:[“itpeople”,”admins”]}

Delete group

    DELETE <root-uri>/userService/groupmanager/{groupName}/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK group was successfully deleted
400 Bad Request Invalid parameter of field names in the request


Example:

Request:

    DELETE <root-uri>/userService/groupmanager/<groupName>/<organizationName> 
    Response:
    200 DELETED

Delete all groups

    DELETE <root-uri>/userService/groupmanager/groups/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK Groups have been successfully deleted
400 Bad Request Invalid parameter of field names in the request


Example:

Request:

    DELETE <root-uri>/userService/groupmanager/groups/<organizationName> 
    Response:
    200 DELETED

Update group

    POST <root-uri>/userService/groupmanager


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
organizationName
JSON String
Organization of the user
optional
description
JSON String
Group description
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK Groups have been successfully updated
304 Not Modified Invalid parameter of field names in the request


Example:

Request:

    POST <root-uri>/userService/groupmanager
    Response:
    200 UPDATED

Role Management

Create role

    PUT <root-uri>/userService/rolemanager/{organizationName}


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional
roleName
JSON String
Name of the group
mandatory


HTTP Response:

Description:

HTTP Status Description
200 Created role was created
400 Bad Request Invalid parameter or field names in the request.


Example:

Request:

     PUT <root-uri>/userService/rolemanager/
    Content-Type: application/json
    {“roleName” : “admin”}


Response:

     HTTP/1.1 200 CREATED

List roles

    GET <root-uri>/userService/rolemanager/roles/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK There was at least one role
404 Not Found No role is present


Example:

Request:

    GET <root-uri>/userService/organizationmanager/<organizationName> 
    Response:
    HTTP/1.1 200 OK

Get roles of user

    GET <root-uri>/userService/rolemanager/users/{userName}/{organizationName} 

Request Message Body:

Name
Type
Description
mandatory/optional
UserName
JSON String
Name of the user
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK User is present
404 Not Found User is not present


Example:

Request:

    GET <root-uri>/userService/rolemanager/users/<username>/<organizationName> 


Response:

    HTTP/1.1 200 OK

User Management

Create user

    PUT <root-uri>/userService/usermanager/
   Host:cloud.example.com
  Content-Type: application/json
  {"username":"newUser",
   "firstname":"ggg",
   "lastname":"ggg",
  "password":"ggg"}


Request Message Body:

Name
Type
Description
mandatory/optional
username JSON String name of the user mandatory
firstname JSON String firstname of the user mandatory
lastname JSON String lastname of the user mandatory
password JSON String user chosen password mandatory
organizationName JSON String Organization of the user optional
certificate JSON String X509 Distinguished Name optional


HTTP Response:

Description:

HTTP Status Description
200 Created User was created
400 Bad Request Invalid parameter or field names in the request.


Example:

Request:

     PUT <root-uri>/userService/usermanager/
    Response:
    200 CREATED

Update user

    PUT <root-uri>/userService/usermanager/update
     Host:cloud.example.com
    Content-Type: application/json
    {"username":"user1",
     "firstname":"ggg1",
     "lastname":"ggg2",


Request Message Body:

Name
Type
Description
mandatory/optional
username JSON String name of the user mandatory
firstname JSON String firstname of the user optional
lastname JSON String lastname of the user optional
password JSON String user chosen password optional
organizationName JSON String Organization of the user optional
certificate JSON String X509 Distinguished Name optional

HTTP Response:


Description:


HTTP Status Description
200 Created User was updated
304 Not Modified User was not updated.


Example:

Request:

     PUT <root-uri>/userService/usermanager/update
    Response:
    200 CREATED

Get user

    GET <root-uri>/userService/usermanager/{userName}/{organizationName}


Request Message Body:

Name
Type
Description
mandatory/optional
userName
JSON String
Name of the user
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK User was present already
404 Not Found User was not present


Example:

Request:

    GET <root-uri>/userService/usermanager/<userName>/<organizationName>
    Response:
    HTTP/1.1 200 OK

List users

    GET <root-uri>/userService/usermanager/users/{organizationName}
    Content-Type: application/json


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK There was at least one user
404 Not Found No user was present


Example:

Request:

    GET <root-uri>/userService/usermanager/usermanager

Response:

    HTTP/1.1 200 OK
    Content-Type: application/json
    {“users”:[“user1”,”user2”]}

Delete user

    DELETE <root-uri>/userService/usermanager/{userName}/{organizationName}


Request Message Body:

Name
Type
Description
mandatory/optional
userName
JSON String
Name of the user
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK user was successfully deleted
404 Not Found user was not found
400 Bad Request Invalid parameter of field names in the request


Example:

Request:

    DELETE <root-uri>/userService/usermanager/<userName>/<organizationName>
    Response:
    200 DELETED

Delete all users

    DELETE <root-uri>/userService/usermanager/users/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK Users have been successfully deleted
400 Bad Request Invalid parameter of field names in the request


Example:

Request:

    DELETE <root-uri>/userService/usermanager/users/<organizationName> 
    Response:
    200 DELETED

Assign/dismiss role

    PUT <root-uri>/userService/usermanager/roles/{username}/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
roleName
JSON String
Name of the role
mandatory
userName
JSON String
Name of the user
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:

HTTP Status Description
HTTP/1.1 200 OK Role was successfully assigned/dismissed
304 Not Modified Invalid parameter of field names in the request


Example:

Request:

     PUT <root-uri>/userService/usermanager/roles/<userName>/<organizationName> 
     Content-Type: application/json
     {“roleName”:”developer”}


Response:


     HTTP/1.1 200 OK

Assign/dismiss group

    PUT <root-uri>/userService/usermanager/groups/{username}


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
userName
JSON String
Name of the user
mandatory


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK Group was successfully assigned/dismissed
304 Not Modified Invalid parameter of field names in the request


Example:

Request:

     PUT <root-uri>/userService/usermanager/groups/<userName>
     Content-Type: application/json
     {“groupName”:”developers”} 


Response:

     HTTP/1.1 200 OK

Get users with role

    GET <root-uri>/userService/usermanager/roles/{roleName}/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
roleName
JSON String
Name of the role
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK There was at least one user
404 Not Found No user was present


Example:

Request:

    GET <root-uri>/userService/usermanager/roles/<roleName>/<organizationName> 
    

Response:

    HTTP/1.1 200 OK

Get users with group

    GET <root-uri>/userService/usermanager/groups/{groupName}/{organizationName} 


Request Message Body:

Name
Type
Description
mandatory/optional
groupName
JSON String
Name of the group
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK There was at least one user
404 Not Found No user was present


Example:

Request:

    GET <root-uri>/userService/usermanager/groups/<groupName>/<organizationName> 
   

Response:

    HTTP/1.1 200 OK

Update credentials

    PUT <root-uri>/userService/usermanager/{username}/{organizationName} 

Request Message Body:

Name
Type
Description
mandatory/optional
oldPassword
JSON String
Old password
mandatory
newPassword
JSON String
New password
mandatory
userName
JSON String
Name of the user
mandatory
organizationName
JSON String
Name of the organization
optional


HTTP Response:

Description:


HTTP Status Description
HTTP/1.1 200 OK Credentials have been successfully updated
401 Unauthorized Provided credentials were wrong
400 Bad Request Invalid parameter or field names in the request.


Example:

Request:

     PUT <root-uri>/userService/usermanager/<username>/<organizationName>


Response:

     200 UPDATED