Laravel Forge JavaScript SDK

Database Users

Database Users

Create a database user

Method

forge.databaseUsers.create(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const user = await forge.databaseUsers.create(server_id, payload);

Payload

1name: 'forge',
2password: 'dolores',
3databases: [
4 1
5]

Payload Parameters

KeyDescription
nameThe username for the new user.
passwordThe password for the new user.
databasesAn array of database IDs referencing the databases the user has access to.

Example Response

1{
2 "user": {
3 "id": 2,
4 "name": "forge",
5 "status": "installing",
6 "created_at": "2016-12-16 16:19:01",
7 "databases": [
8 1
9 ]
10 }
11}

List database users

Method

forge.databaseUsers.list(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const users = await forge.databaseUsers.list(server_id);

Example Response

1{
2 "users": [
3 {
4 "id": 2,
5 "name": "forge",
6 "status": "installing",
7 "created_at": "2016-12-16 16:19:01",
8 "databases": [
9 1
10 ]
11 }
12 ]
13}

Get a database user

Method

forge.databaseUsers.get(server_id, user_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const user = await forge.databaseUsers.get(server_id, user_id);

Example Response

1{
2 "user": {
3 "id": 2,
4 "name": "forge",
5 "status": "installing",
6 "created_at": "2016-12-16 16:19:01",
7 "databases": [
8 1
9 ]
10 }
11}

Update a database user

This method may be used to update the databases the Database User has access to.

Method

forge.databaseUsers.update(server_id, user_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const updatedUser = await forge.databaseUsers.update(server_id, user_id, payload);

Payload

1{
2 databases: [
3 2
4 ]
5}

Payload Parameters

KeyDescription
databasesAn array of database IDs referencing the databases the user has access to.

Example Response

1{
2 "user": {
3 "id": 2,
4 "name": "forge",
5 "status": "installing",
6 "created_at": "2016-12-16 16:19:01",
7 "databases": [
8 1,
9 2
10 ]
11 }
12}

Delete a database user

Method

forge.databaseUsers.delete(server_id, user_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.databaseUsers.delete(server_id, user_id);

Edit this page on GitHub