Usage: If you want to use the API, you have to include the Resources/public/js/api.js
script.
Dependencies: jQuery, FOSJsRouting
The response from the server is always a JSON object and it always has a result
property,
that is "OK" (success) or "ERR" (failure). On failure, a message
property is also present.
The authentication is done with sessions, and the user must have ROLE_ADMIN
role assigned.
Creates a new user in the database with the given parameters.
Parameter name | Type | Notes |
---|---|---|
username | String | |
String | Must be a valid e-mail address. | |
password | String |
Response message | Description |
---|---|
OK | User added successfully. |
BAD_PARAMS | Some parameters are invalid or missing. |
USERNAME_OCCUPIED | There is another user with that username. |
Removed the given user from the database permanently.
Parameter name | Type | Notes |
---|---|---|
id | integer | The ID of the user. |
Response message | Description |
---|---|
OK | User removed successfully. |
BAD_PARAMS | Some parameters are invalid or missing. |
NOT_FOUND | The user with the specified ID is not found. |
SELF_REMOVAL | Self removal is forbidden. |
Modifies the users's username, e-mail or password. The given parameters will replace the current values (except for the password) in the database.
Parameter name | Type | Notes |
---|---|---|
id | integer | The ID of the user. |
username | String | |
String | Must be a valid e-mail address. | |
password | String | Leave it empty to not change the password. |
Response message | Description |
---|---|
OK | User modified successfully. |
BAD_PARAMS | Some parameters are invalid or missing. |
NOT_FOUND | The user with the specified ID is not found. |
USERNAME_OCCUPIED | There is another user with that username. |