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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
idIntegerID of person to switch to.Yes, unless username is specified.
usernameStringUser name of person to switch to.Yes, unless id is specified.
tokenInteger1 to get an authentication token, 0 not to.No0

Specify id or username, but not both.

Responses

CodeDescription
200Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
404The 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

VersionChanges
4.1token input parameter added.
3.13Function added.