WebYaST REST API Documentation

Copyright © 2013 Novell, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled "GNU Free Documentation License".

Users and Groups Management

Only authenticated users are allowed to access the API. Authentication is done by sending a Basic HTTP Authorisation header.

Table of Contents

Overview

This module allows you to manage local non-system users. You can view, edit, create or delete users. Similarly, you can view, edit, create or delete groups.

PolicyKit Access Rights

The following PolicyKit permissions are needed:

org.opensuse.yast.modules.yapi.users

org.opensuse.yast.modules.yapi.groups

Users Actions

View a single or several users, update, create or delete a specific user

GET /users

Get the list of all users

CURL example:

curl -u <user> https://<hostname>:4984/users.xml

Result: Example

POST /users

Create a new user

CURL example:

curl -u <user> -X POST --data @user_post_request.xml -H "Content-Type: text/xml" https://<hostname>:4984/users.xml

Body: Example

Result: Example

GET /users/<user_name>

Arguments:

View details about a specific user

CURL example:

curl -u <user> https://<hostname>:4984/users/<user_name>.xml

Result: Example

PUT /users/<user_name>

Arguments:

Update attributes of a user. If attributes 'groupname' or 'grouplist' are not provided they are set to their default values.

CURL example:

curl -u <user> -X PUT --data @user_put_request.xml -H "Content-Type: text/xml" https://<hostname>:4984/users/<user_name>.xml

Body: Example

Result: Example

DELETE /users/<user_name>

Arguments:

Delete the user.

CURL example:

curl -u <user> -X DELETE https://<hostname>:4984/users/<user_name>.xml

Groups Actions

View a single or several groups, update, create or delete a specific group

GET /groups

Get the list of all groups

CURL example:

curl -u <user> https://<hostname>:4984/groups.xml

Result: Example

POST /groups

Create a new group. If adding members to that group, those must already exists. Two types of groups can be created: system and local. If created successfuly, code 201 is returned.

CURL example:

curl -u <user> -X POST --data @group_post_request.xml -H "Content-Type: text/xml" https://<hostname>:4984/groups.xml

Body: Example

GET /groups/<group_name>

Arguments:

View details about a specific group

CURL example:

curl -u <user> https://<hostname>:4984/groups/<group_name>.xml

Result: Example

PUT /groups/<group_name>

Arguments:

Update attributes of a group.

CURL example:

curl -u <user> -X PUT --data @group_put_request.xml -H "Content-Type: text/xml" https://<hostname>:4984/groups/<group_name>.xml

Body: Example

Result: Example

DELETE /groups/<group_name>

Arguments:

Delete a group. The group must not have any members, otherwise an error will be returned.

CURL example:

curl -u <user> -X DELETE https://<hostname>:4984/groups/<group_name>.xml