User attributes
field | type | description |
---|---|---|
name | string | name of the user |
read_only | boolean | true if the user is read only |
protected | boolean | true if the user is protected hence it cannot be updated |
dbms_attributes | object | (optional) data about the user in the database |
DBMS attributes
password_encryption
: (optional) encryption algorithm used for the user password. can be either SCRAM-SHA-256
or MD5
. currently only available for PostgreSQL databasesExample object:
{
"name": "metabase",
"read_only": true,
"protected": false,
"dbms_attributes" : {
"password_encryption" : "SCRAM-SHA-256"
}
}
GET https://$DB_API_URL/api/databases/[:db]/users
List all users for a database.
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X GET https://$DB_API_URL/api/databases/my-db-123/users
Returns 200 OK
{
"database-users": [
{
"name": "my-db-123",
"read_only": false,
"protected": true,
"dbms_attributes" : {
"password_encryption" : "SCRAM-SHA-256"
}
},
{
"name": "metabase",
"read_only": true,
"protected": false,
"dbms_attributes" : {
"password_encryption" : "SCRAM-SHA-256"
}
}
]
}
POST https://$DB_API_URL/api/databases/[:db]/users
Create a new user on the given database. The HTTP query returns 201.
name
: Must have between 6 and 32 lower case alphanumerical characters and hyphens. It can’t have an hyphen at the beginning or at the end, nor two hyphens in a row.password
and password_confirmation
: (Optional) Password of the new user. Must be between 24 and 64 characters long. If none is provided, Scalingo will generate one and display it in a toast notification.read_only
: Should the new user be read only?curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X POST https://$DB_API_URL/api/databases/my-db-123/users -d \
'{
"database_user": {
"database_id": "5c599fd6f18b3202f7ab4e66",
"name": "my-user",
"read_only": false,
"password": null,
"password_confirmation": null
}
}'
Returns 201 Created
{
"name": "my-user",
"read_only": false,
"protected": false,
"password": "K_gaef6ripo7Ao4Uaxai6Kiey",
"dbms_attributes" : {
"password_encryption" : "SCRAM-SHA-256"
}
}
PATCH https://$DB_API_URL/api/databases/[:db]/users/[:username]
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X PATCH https://$DB_API_URL/api/databases/my-db-123/users/my-user -d \
'{
"database_user": {
"database_id": "my-db-123",
"password": "K_gaef6ripo7Ao4Uaxai6Kiey",
"password_confirmation": "K_gaef6ripo7Ao4Uaxai6Kiey"
}
}'
Returns 200 OK
This endpoint allows you to reset a user password. The new password will be generated by Scalingo and returned in the response.
POST https://$DB_API_URL/api/databases/[:db]/users/[:username]/reset_password
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X POST https://$DB_API_URL/api/databases/my-db-123/users/my-user -d ''
Returns 200 OK
{
"name": "username",
"read_only": false,
"protected": false,
"password": "generated password",
"dbms_attributes" : {
"password_encryption" : "SCRAM-SHA-256"
}
}
DELETE https://$DB_API_URL/api/databases/[:db]/users/[:username]
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X DELETE https://$DB_API_URL/api/databases/my-db-123/users/my-user
Returns 204 No Content