Users

OneAndOne::User()

The User class allows a user to perform actions against the 1and1 API.

list(page: nil, per_page: nil, sort: nil, q: nil, fields: nil)

List all users on your account.

Parameters:
  • page (int) – Allows the use of pagination. Indicate which page to start on.
  • per_page (int) – Number of items per page.
  • sort (str) – sort: 'name' retrieves a list of elements sorted alphabetically. sort: 'creation_date' retrieves a list of elements sorted by their creation date in descending order.
  • q (str) – q is for query. Use this parameter to return only the items that match your search query.
  • fields (str) – Returns only the parameters requested. (i.e. fields: ‘id, name, description, hardware.ram’)
Return type:

JSON

create(name: nil, description: nil, password: nil, email: nil)

Create a new user account.

Parameters:
  • name (str) – user name.
  • description (str) – user description.
  • password (str) – user password.
  • email (str) – user email.
Return type:

JSON

get(user_id: @id)

Returns a user account’s current specs.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

modify(user_id: @id, description: nil, password: nil, email: nil, state: nil)

Modify a user account.

Parameters:
  • user_id (str) – the unique identifier for the user.
  • password (str) – user password.
  • email (str) – user email.
  • description (str) – user description.
  • state (str) – allows you to enable and disable users. Possible values are "ACTIVE" or "DISABLE".
Return type:

JSON

delete(user_id: @id)

Delete a user account.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

api(user_id: @id)

Return a user’s API access credentials.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

enable_api(user_id: @id, active: nil)

Enable or disable a user’s API access.

Parameters:
  • user_id (str) – the unique identifier for the user.
  • active (bool) – API access.
Return type:

JSON

api_key(user_id: @id)

Return a user’s API key.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

change_key(user_id: @id)

Change a user’s API key.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

ips(user_id: @id)

List the IP’s from which a user can access the API.

Parameters:
  • user_id (str) – the unique identifier for the user.
Return type:

JSON

add_ips(user_id: @id, ips: nil)

Add IP’s from which a user can access the API.

Parameters:
  • user_id (str) – the unique identifier for the user.
  • ips (array) – an array containing at least one IP string.
Return type:

JSON

remove_ip(user_id: @id, ip: nil)

Remove API access for an IP.

Parameters:
  • user_id (str) – the unique identifier for the user.
  • ip (str) – IP to be removed.
Return type:

JSON