Create, Update, and Delete

Create a User

Create a new user. User logins must be unique across all users.

Method: POST
Path: /pulp/api/v2/users/
Permission: create
Request Body Contents:
  • login (string) - unique login for the user

  • name (string) - (optional) name of the user

  • password (string) - (optional) password of the user used for authentication

Response Codes:
  • 201 - if the user was successfully created

  • 400 - if one or more of the parameters is invalid

  • 409 - if there is already a user with the given login

Return: details of created user

Sample Request:

{
 "login": "test-login",
 "password": "test-password",
 "name": "test name"
}

Sample 201 Response Body:

{
 "name": "test name",
 "roles": [],
 "_ns": "users",
 "login": "test-login",
 "_id": {
   "$oid": "502c83f6e5e7100b0a000035"
 },
 "id": "502c83f6e5e7100b0a000035",
 "_href": "/pulp/api/v2/users/test-login/"
}

Update a User

The update user call is used to change the details of an existing consumer.

Method: PUT
Path: /pulp/api/v2/users/<user_login>/
Permission: update
Request Body Contents: The body of the request is a JSON document with a root element called delta. The contents of delta are the values to update. Only changed parameters need be specified. The following keys are allowed in the delta object. Descriptions for each parameter can be found under the create user API:
  • password

  • name

  • roles (array) - (optional) array of roles to update the user to. In this case, relevant permissions for the user will be updated as well.

Response Codes:
  • 200 - if the update was executed and successful

  • 404 - if there is no user with the given login

  • 400 - if one or more of the parameters is invalid

Return: database representation of the user including changes made by the update

Sample Request:

{
 "delta": {"name": "new name", "password": "new-password"}
}

Sample 200 Response Body:

{
 "name": "new name",
 "roles": [],
 "_ns": "users",
 "login": "test-login",
 "_id": {
   "$oid": "502c83f6e5e7100b0a000035"
 },
 "id": "502c83f6e5e7100b0a000035"
}

Delete a User

Deletes a user from the Pulp server. Permissions granted to the user are revoked as well.

Method: DELETE
Path: /pulp/api/v2/users/<user_login>/
Permission: delete
Query Parameters:
Response Codes:
  • 200 - if the user was successfully deleted

  • 400 - if the user cannot be deleted because it is the last super user

  • 404 - if there is no user with the given login

Return: null