Account

Resources related to accounts.

Users

The Users resource represents all unix users.

List resource

GET /api/v1.0/account/users/

Returns a list of all current users.

Example request:

GET /api/v1.0/account/users/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
          "bsdusr_builtin": true,
          "bsdusr_email": "",
          "bsdusr_full_name": "root",
          "bsdusr_group": 0,
          "bsdusr_home": "/root",
          "bsdusr_locked": false,
          "bsdusr_password_disabled": false,
          "bsdusr_shell": "/bin/csh",
          "bsdusr_smbhash": "root:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:E6FCEFB62A365065CE5B5F04AB12B455:[U          ]:LCT-52272D9E:",
          "bsdusr_uid": 0,
          "bsdusr_sshpubkey": "",
          "bsdusr_unixhash": "$6$d8doVGxjhDhL4feI$YpTtmlhCmbc6BJ4MQcBsPvZA0Ge4SMnAyZn9CfZLpkuP71g8bPq6DkKJBmcN61z2oQSj0K8RtaqmKltc9HsMg0",
          "bsdusr_username": "root",
          "bsdusr_sudo": false,
          "id": 1
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/account/users/

Creates a new user and returns the new user object.

Example request:

POST /api/v1.0/account/users/ HTTP/1.1
Content-Type: application/json

  {
          "bsdusr_username": "myuser",
          "bsdusr_creategroup": true,
          "bsdusr_full_name": "haha",
          "bsdusr_password": "aa",
          "bsdusr_uid": 1111
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "bsdusr_builtin": false,
          "bsdusr_email": "",
          "bsdusr_full_name": "My User",
          "bsdusr_group": 0,
          "bsdusr_home": "/nonexistent",
          "bsdusr_locked": false,
          "bsdusr_password_disabled": false,
          "bsdusr_shell": "/bin/csh",
          "bsdusr_smbhash": "myuser:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:E6FCEFB62A365065CE5B5F04AB12B455:[U          ]:LCT-52272D9E:",
          "bsdusr_uid": 1111,
          "bsdusr_sshpubkey": "",
          "bsdusr_unixhash": "$6$d8doVGxjhDhL4feI$YpTtmlhCmbc6BJ4MQcBsPvZA0Ge4SMnAyZn9CfZLpkuP71g8bPq6DkKJBmcN61z2oQSj0K8RtaqmKltc9HsMg0",
          "bsdusr_username": "myuser",
          "bsdusr_sudo": false,
          "id": 25
  }
JSON Parameters:
 
  • bsdusr_username (string) – unix username
  • bsdusr_full_name (string) – name of the user
  • bsdusr_password (string) – password for the user
  • bsdusr_uid (integer) – unique user id
  • bsdusr_group (integer) – id of the group object
  • bsdusr_creategroup (boolean) – create a group for the user
  • bsdusr_mode (string) – unix mode to set the homedir
  • bsdusr_shell (string) – shell for the user login
  • bsdusr_password_disabled (boolean) – disabled password login
  • bsdusr_locked (boolean) – lock user login
  • bsdusr_sudo (boolean) – enable sudo for the user
  • bsdusr_sshpubkey (string) – SSH authorized keys file content
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Update resource

PUT /api/v1.0/account/users/(int: id)/

Creates a new user and returns the new user object.

Example request:

PUT /api/v1.0/account/users/25/ HTTP/1.1
Content-Type: application/json

  {
          "bsdusr_full_name": "My Name",
          "bsdusr_shell": "/bin/bash",
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "bsdusr_builtin": false,
          "bsdusr_email": "",
          "bsdusr_full_name": "My Name",
          "bsdusr_group": 0,
          "bsdusr_home": "/nonexistent",
          "bsdusr_locked": false,
          "bsdusr_password_disabled": false,
          "bsdusr_shell": "/bin/bash",
          "bsdusr_smbhash": "myuser:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:E6FCEFB62A365065CE5B5F04AB12B455:[U          ]:LCT-52272D9E:",
          "bsdusr_uid": 1111,
          "bsdusr_sshpubkey": "",
          "bsdusr_unixhash": "$6$d8doVGxjhDhL4feI$YpTtmlhCmbc6BJ4MQcBsPvZA0Ge4SMnAyZn9CfZLpkuP71g8bPq6DkKJBmcN61z2oQSj0K8RtaqmKltc9HsMg0",
          "bsdusr_username": "myuser",
          "bsdusr_sudo": false,
          "id": 25
  }
JSON Parameters:
 
  • bsdusr_full_name (string) – name of the user
  • bsdusr_password (string) – password for the user
  • bsdusr_uid (integer) – unique user id
  • bsdusr_group (integer) – id of the group object
  • bsdusr_mode (string) – unix mode to set the homedir
  • bsdusr_shell (string) – shell for the user login
  • bsdusr_password_disabled (boolean) – disabled password login
  • bsdusr_locked (boolean) – lock user login
  • bsdusr_sudo (boolean) – enable sudo for the user
  • bsdusr_sshpubkey (string) – SSH authorized keys file content
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Delete resource

DELETE /api/v1.0/account/users/(int: id)/

Delete user id.

Example request:

DELETE /api/v1.0/account/users/25/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error

Change password

POST /api/v1.0/account/users/(int: id)/password/

Change password of user id.

Example request:

POST /api/v1.0/account/users/25/password/ HTTP/1.1
Content-Type: application/json

  {
          "bsdusr_password": "newpasswd"
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json


  {
          "bsdusr_builtin": false,
          "bsdusr_email": "",
          "bsdusr_full_name": "My User",
          "bsdusr_group": 0,
          "bsdusr_home": "/nonexistent",
          "bsdusr_locked": false,
          "bsdusr_password_disabled": false,
          "bsdusr_shell": "/bin/csh",
          "bsdusr_smbhash": "myuser:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:E6FCEFB62A365065CE5B5F04AB12B455:[U          ]:LCT-52272D9E:",
          "bsdusr_uid": 0,
          "bsdusr_unixhash": "$6$d8doVGxjhDhL4feI$YpTtmlhCmbc6BJ4MQcBsPvZA0Ge4SMnAyZn9CfZLpkuP71g8bPq6DkKJBmcN61z2oQSj0K8RtaqmKltc9HsMg0",
          "bsdusr_username": "myuser",
          "bsdusr_sudo": false,
          "id": 25
  }
JSON Parameters:
 
  • bsdusr_password (string) – new password
Status Codes:
  • 200 – no error

Get user groups

GET /api/v1.0/account/users/(int: id)/groups/

Get a list of groups of user id.

Example request:

GET /api/v1.0/account/users/25/groups/ HTTP/1.1
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript

  []
Status Codes:
  • 200 – no error

Set user groups

POST /api/v1.0/account/users/(int: id)/groups/

Set a list of groups of user id.

Example request:

POST /api/v1.0/account/users/25/groups/ HTTP/1.1
Accept: application/json, text/javascript

  [
          "wheel",
          "ftp"
  ]

Example response:

HTTP/1.1 202 Accepted
Vary: Accept
Content-Type: text/javascript

  [
          "wheel",
          "ftp"
  ]
Status Codes:
  • 202 – no error

Groups

The Groups resource represents all unix groups.

List resource

GET /api/v1.0/account/groups/

Returns a list of all current groups.

Example request:

GET /api/v1.0/account/groups/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
          "bsdgrp_builtin": False,
          "bsdgrp_gid": 1111,
          "bsdgrp_group": "myuser",
          "bsdgrp_sudo": false,
          "id": 33
  },
  {
          "bsdgrp_builtin": true,
          "bsdgrp_gid": 0,
          "bsdgrp_group": "wheel",
          "bsdgrp_sudo": false,
          "id": 1
  },
  {
          "bsdgrp_builtin": true,
          "bsdgrp_gid": 1,
          "bsdgrp_group": "daemon",
          "bsdgrp_sudo": false,
          "id": 2
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/account/groups/

Creates a new group and returns the new group object.

Example request:

POST /api/v1.0/account/groups/ HTTP/1.1
Content-Type: application/json

  {
          "bsdgrp_gid": 1200,
          "bsdgrp_group": "mygroup"
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "bsdgrp_builtin": false,
          "bsdgrp_gid": 1200,
          "bsdgrp_group": "mygroup",
          "bsdgrp_sudo": false,
          "id": 34
  }
JSON Parameters:
 
  • bsdgrp_gid (integer) – group unique id
  • bsdgrp_group (string) – unix name for the group
  • bsdgrp_sudo (boolean) – enable sudo for this group
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Update resource

PUT /api/v1.0/account/groups/(int: id)/

Update group id.

Example request:

PUT /api/v1.0/account/groups/34/ HTTP/1.1
Content-Type: application/json

  {
          "bsdgrp_group": "newgroup"
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "bsdgrp_builtin": false,
          "bsdgrp_gid": 1200,
          "bsdgrp_group": "newgroup",
          "bsdgrp_sudo": false,
          "id": 34
  }
JSON Parameters:
 
  • bsdgrp_group (string) – unix name for the group
  • bsdgrp_sudo (boolean) – enable sudo for this group
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Delete resource

DELETE /api/v1.0/account/groups/(int: id)/

Delete group id.

Example request:

DELETE /api/v1.0/account/groups/34/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error