API v4
Sections: List groups | Show a group | Create a group | Update a group | Add a user to a group | Delete a user from a group | Delete a group
List groups
Returns all the groups in Team Password Manager:
GET /groups.json
The response from these request is paginated and /count.json and /page/num.json can be used. See the section on pagination for more information. Example: GET /groups/page/2.json
If successful, the response code is 200 OK with the results of the call in the response body.
*Note: users with "Normal user" and "Project Manager" roles can also execute this request. Users with "Read only" role can't.
Example response body:
[
{
"id": 3,
"name": "External users",
"num_users": 1
},
{
"id": 2,
"name": "IT works",
"num_users": 3
},
{
"id": 7,
"name": "Read Only Users",
"num_users": 1
},
{
"id": 4,
"name": "Test group",
"num_users": 0
},
{
"id": 1,
"name": "Web work",
"num_users": 5
}
]
Show a group
This method returns all the data of a group, identified by its internal id.
GET /groups/ID.json
If successful, the response code is 200 OK with the results of the call in the response body.
*Note: users with "Normal user" and "Project Manager" roles can also execute this request. Users with "Read only" role can't.
Example response body:
{
"id": 2,
"name": "IT works",
"users": [
{
"id": 1,
"username": "john",
"email_address": "john@teampasswordmanager.com",
"name": "John Boss",
"role": "Admin"
},
{
"id": 7,
"username": "janine@teampasswordmanager.com",
"email_address": "janine@teampasswordmanager.com",
"name": "Janine Black",
"role": "Normal user"
},
{
"id": 8,
"username": "tom@teampasswordmanager.com",
"email_address": "tom@teampasswordmanager.com",
"name": "Tom Landy",
"role": "Normal user"
}
],
"created_on": "2014-06-05 16:35:12",
"created_by": {
"id": 1,
"username": "john",
"email_address": "john@teampasswordmanager.com",
"name": "John Boss",
"role": "Admin"
},
"updated_on": "2014-07-23 23:53:51",
"updated_by": {
"id": 1,
"username": "john",
"email_address": "john@teampasswordmanager.com",
"name": "John Boss",
"role": "Admin"
}
}
Create a group
POST /groups.json
The request body must include the name for the group (which is the only field that can be set in a group):
{
"name": "This is a new group"
}
If successful, the response code is 201 Created with the internal id of the group in the response body:
{
"id": 15
}
Update a group
PUT /groups/ID.json
The request body must include the name for the group (which is the only field to be updated):
{
"name": "This group is not new anymore"
}
If successful, the response code is 204 No content and the response body is empty.
Add a user to a group
PUT /groups/GROUP_ID/add_user/USER_ID.json
If successful, the response code is 204 No content and the response body is empty.
Delete a user from a group
PUT /groups/GROUP_ID/delete_user/USER_ID.json
If successful, the response code is 204 No content and the response body is empty.
Delete a group
DELETE /groups/ID.json
If successful, the response code is 204 No content and the response body is empty.