Skip to content

REST: Users and groups management

Aleksey Aleev edited this page Aug 3, 2012 · 14 revisions

Genesis internal user management

List users

Path: /rest/users

Type: GET

Example response:

    [
        {
           "username": "john",
           "email": "[email protected]",
           "firstName": "John",
           "lastName": "Doe",
           "jobTitle": "Developer"
        },
        {
           "username": "jane",
           "email": "[email protected]",
           "firstName": "Jane",
           "lastName": "Doe",
           "jobTitle": "Jane Doe"
        }
    ]

Create user

Path: /rest/users

Type: POST

Input data:

{
    "username": "jane",
    "email": "[email protected]",
    "firstName": "Jane",
    "lastName": "Doe",
    "jobTitle": "Jane Doe",
    "password": "qwerty",
    "groups": ["group1", "group2"]
}
Entry name Type Mandatory Description
username String Y User name
email String Y User email
firstName String Y User first name
lastName String Y User last name
jobTitle String N User job title
password String Y User password
groups Array of string N List of existing groups to assign to a user

Example response

Success

{
    "result":
	{
    	    "username":"jane1",
    	    "email":"[email protected]",
	    "firstName":"Jane",
	    "lastName":"Doe",
	    "jobTitle":"Jane Doe"
	},
        "isSuccess":true
}

Error

See common result object

Delete user

Path: /rest/users/(username)

Type: DELETE

Results:

Success: Deleted user. See Create use (?)

Failure: See common result object

Update user

Path/rest/users/(username)

Type: PUT

Input data:

{
    "email": "[email protected]",
    "firstName": "Jane",
    "lastName": "Doe",
    "jobTitle": "Jane Doe",
    "groups": ["group1", "group2"]
}

Success

See Create user

Error

See common result object

Genesis internal user group management

List groups

Path/rest/groups

Type: GET

Example response:

[
    {
      "name":"group-1",
      "description":"group-1 description",
      "mailingList":"[email protected]",
      "id":1
    },
    {
      "name":"group-2",
      "description":"group-2 description",
      "mailingList":"[email protected]",
      "id":2
    }
]

Create group

Path/rest/groups

Type: POST

Input data:

{
    "name":"group-5",
    "description":"my group",
    "mailingList":"[email protected]",
    "users":["jane","mike"]
}
Entry name Type Mandatory Description
name String Y Group name
description String Y Group description
mailingList String N Group mailing list
users Array of String N Names of users who will be included in new group

Example response

Success

{
    "result":{
        "name":"new-group",
        "description":"group desc",
        "mailingList":"[email protected]",
        "id":6
    },
    "isSuccess":true
}

Error

See common result object

DeleteВ group

Path: /rest/groups/(id)

Type: DELETE

Results:

Success: Deleted group. See Create group

Failure: See common result object

Update group

Path/rest/groups/(id)

Type: PUT

Input data:

{ 
    "description":"descr",
    "mailingList":"[email protected]",
    "id":3,
    "users":["john","mike"]
}
Entry name Type Mandatory Description
description String Y Group description
mailingList String Y Group mailing list
users Array of String Y Names of users who will be included in the group

Example response

Success

{
    "result":{
        "name":"group-1",
        "description":"descr",
        "mailingList":"[email protected]",
        "id":3
    },
    "isSuccess":true
}

Error

See common result object

Clone this wiki locally