Retrieve User by Username

You can use this API request to return a user node by their username.

/services/v2/user/getByUsername.json?username=[data]

You can use the following parameters in your Get User by Username request:

Specific: username

🚧

Permissions & Notes:

  • You must have the View user's profile permission under Anonymous Roles in the Advanced Editor.

  • Do not place quotes around the username.

  • We added this request in version 1.6.3.

Sample Request

A GET get user by username request to get a user (username: dzone) sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:

curl 
-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X GET "https://apidocs.cloud.answerhub.com/services/v2/user/getByUsername.json?username=dzone" -v

Sample Response

Successful Response:

  • HTTP Status 200 - OK
{
    "id": 7,
    "type": "user",
    "creationDate": 1542778947000,
    "creationDateFormatted": "11/21/2018 05:42 AM",
    "modificationDate": 1549289924000,
    "username": "dzone",
    "slug": "dzone",
    "gold": 0,
    "silver": 0,
    "bronze": 2,
    "reputation": 36,
    "moderator": false,
    "superuser": true,
    "avatar": "http://apidocs.cloud.answerhub.com/users/7/photo/view.html",
    "postCount": 10,
    "followerCount": 0,
    "followCount": 0,
    "userFollowCount": 0,
    "active": true,
    "suspended": false,
    "deactivated": false,
    "groups": [
        {
            "id": "5",
            "creationDate": 1542778947000,
            "creationDateFormatted": "11/21/2018 05:42 AM",
            "modificationDate": 1547066163000,
            "name": "Super Users"
        },
        {
            "id": "6",
            "creationDate": 1542778947000,
            "creationDateFormatted": "11/21/2018 05:42 AM",
            "modificationDate": 1547066174000,
            "name": "Network Administrators"
        }
    ]
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!