JSON API » user » user/switch
Gets the login data for a different user, creating the pseudo-user if necessary.
Input parameters
Requires authentication and the administrator role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| id | Integer | ID of person to switch to. | Yes, unless username is specified. | |
| username | String | User name of person to switch to. | Yes, unless id is specified. | |
| token | Integer | 1 to get an authentication token, 0 not to. | No | 0 |
Specify id or username, but not both.
Responses
| Code | Description |
|---|---|
| 200 | Success. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 404 | The person does not exist, or you may not switch to them. |
Data returned
Fields of user.
Example: With username
http://enswitch.example.com/api/json/user/switch/?auth_username=user;auth_password=password;username=user@example.com{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123, "username":"user@example.com", ... } }
Change history
| Version | Changes |
|---|---|
| 4.1 | token input parameter added. |
| 3.13 | Function added. |
