User

The term User can be used interchangeably with the term Storage Account.

List Users

Lists all users, optionally filtered by a particular cluster.

GET /api/v1/users/
Query Parameters:
 
  • cluster -- Filter by cluster.
  • user -- Filter by user.
Status:

200 OK

Status:

400 Bad Request

Status:

404 Not Found

Example request:

Lists all users in all clusters

curl -1 https://platform.swiftstack.com/api/v1/users/ -H 'Authorization: apikey <user>:<api_key>'

Lists all users in a particular cluster

curl -1 https://platform.swiftstack.com/api/v1/users/?cluster=<cluster_id>&format=json -H 'Authorization: apikey <user>:<api_key>'

Example response:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
    "meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 2},
    "objects": [
        {
            "cluster": "/api/v1/clusters/2/",
            "id": "1",
            "is_superuser": true,
            "resource_uri": "/api/v1/users/1/",
            "user": "muster",
            "enabled": true,
        },
        {
            "cluster": "/api/v1/clusters/2/",
            "id": "2",
            "is_superuser": false,
            "resource_uri": "/api/v1/users/2/",
            "user": "ruster",
            "enabled": true,
        }
    ]
}

Create User

POST /api/v1/users/
Form Parameters:
 
  • cluster -- The API url of the cluster to which the user should be added.
  • user -- The new user's name.
  • password -- The new user's password. NOTE: Passwords must be at least 20 characters
  • is_superuser -- Is the new user a superuser (optional, default false)
  • enabled -- Is the new user enabled (default true)
Status:

201 Created

Status:

400 Bad Request

Status:

404 Not Found

Example request:

curl -1 https://platform.swiftstack.com/api/v1/users/?format=json -H 'Authorization: apikey <user>:<api_key>' -H 'content-type: application/json' -d '{"password": "twentycharacterpassword", "user": "templeton", "cluster": "/api/v1/clusters/<cluster_id>/"}' -X POST

Example response:

1
2
3
4
5
6
7
8
9
{
    "cluster": "/api/v1/clusters/2/",
    "id": "21",
    "is_superuser": false,
    "enabled": true,
    "resource_uri": "/api/v1/users/2/",
    "user": "templeton",
    "password": "twentycharacterpassword"
}

Note

The POST response will include the password.

View User Details

Display information about a user.

GET /api/v1/users/<user_id>/
Status:200 OK
Status:400 Bad Request
Status:404 Not Found

Example request:

curl -1 https://platform.swiftstack.com/api/v1/users/<user_id>/ -H 'Authorization: apikey <user>:<api_key>'

Example response:

1
2
3
4
5
6
7
8
{
    "cluster": "/api/v1/clusters/2/",
    "id": "21",
    "is_superuser": false,
    "enabled": true,
    "resource_uri": "/api/v1/users/21/",
    "user": "templeton"
}

Note

The GET response will not include the password.

Change User Details

Change details about a user.

PATCH /api/v1/users/<user_id>/
Form Parameters:
 
  • password -- The user's new password. NOTE: Passwords must be at least 20 characters
  • is_superuser -- Whether the user is a superuser
  • enabled -- Whether the user is enabled
Status:

202 Accepted

Status:

400 Bad Request

Status:

404 Not Found

Example request:

curl -1 https://platform.swiftstack.com/api/v1/users/<user_id>/?format=json -H 'Authorization: apikey <user>:<api_key>' -H 'content-type: application/json' -d '{"password": "differenttwentycharacterpassword"}' -X PATCH

Example response:

1
2
3
4
5
6
7
8
9
{
    "cluster": "/api/v1/clusters/2/",
    "id": "21",
    "is_superuser": false,
    "enabled": true,
    "resource_uri": "/api/v1/users/21/",
    "user": "templeton",
    "password": "differenttwentycharacterpassword"
}

Note

The PATCH response will include the password from the request, if any was sent.

Delete User

Deletes user on a cluster

DELETE /api/v1/users/<user_id>
Status:204 No Content
Status:400 Bad Request
Status:404 Not Found

Note

Deleting the user's login will not erase their data. You can recover access to the data by recreating another user with same login name.

Example request:

curl -1 https://platform.swiftstack.com/api/v1/users/<user_id>/ -H 'Authorization: apikey <user>:<api_key>' -X DELETE