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');23const user = await forge.databaseUsers.create(server_id, payload);
Payload
1name: 'forge',2password: 'dolores',3databases: [4 15]
Payload Parameters
Key | Description |
---|---|
name | The username for the new user. |
password | The password for the new user. |
databases | An 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 19 ]10 }11}
List database users
Method
forge.databaseUsers.list(server_id)
Usage
1const forge = new Forge('API_TOKEN');23const 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 110 ]11 }12 ]13}
Get a database user
Method
forge.databaseUsers.get(server_id, user_id)
Usage
1const forge = new Forge('API_TOKEN');23const 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 19 ]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');23const updatedUser = await forge.databaseUsers.update(server_id, user_id, payload);
Payload
1{2 databases: [3 24 ]5}
Payload Parameters
Key | Description |
---|---|
databases | An 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 210 ]11 }12}
Delete a database user
Method
forge.databaseUsers.delete(server_id, user_id)
Usage
1const forge = new Forge('API_TOKEN');23await forge.databaseUsers.delete(server_id, user_id);
Edit this page on GitHub