Skip to content
Kason Chan edited this page Jun 10, 2015 · 20 revisions

Users can be anyone or anything.

Field guide

Field Type Description
login String The user-defined login, handle, or alias that this user identifies themselves with.
Logins are unique.
Valid length range: 1 - 50.
Example: "login": "playchat"
avatar_url String A HTTP-based URL pointing to the user’s avatar image.
Nullable.
Default to "".
Example: "avatar_url": ""
type String Identifies the user is admin or normal user.
Default to user.
Example: "type": "admin"
email String The email that this user identifies themselves with.
Emails are unique.
Valid format: ([a-zA-Z0-9._]+)@([a-zA-Z0-9._]+)(\.)([a-zA-Z0-9]+).
Example: "email": "[email protected]"
location String The user-defined location for this account’s profile. Not necessarily a location nor parseable.
Nullable.
Valid length range: 0 - 100.
Example: "location": "playchat"
password String The used-defined password.
Valid length range: 8 - 50.
Example: "password": "HelloPlayChatters"
confirmed Boolean When true, indicates that the user has confirmed creating the login.
Default to false.
Example: "confirmed": true
created_at Long The system datetime that the user account was created on PlayChat.
Example: "created_at": 1432441527583
updated_at Long The system datetime that the user account was updated on PlayChat.
Example: "updated_at": 1432441527583

Get a single user

Request
Route
GET /users/:username
Response
Status
200 OK
Body
{
  "login": "playchat",
  "avatar_url": "",
  "type": "user",
  "email": "[email protected]",
  "location": "", 
  "confirmed": true, 
  "created_at": 1432441527583,
  "updated_at": 1432441527583
}

Get the authenticated user

You must pass authentication information with your request.

Request
Route
GET /user
Response
Status
200 OK
Body
{
  "login": "playchat",
  "avatar_url": "",
  "type": "user",
  "email": "[email protected]",
  "location": "", 
  "confirmed": true, 
  "created_at": 1432441527583,
  "updated_at": 1432441527583
}

Get all users

Request
Route
GET /users
Response
Status
200 OK
Body
[ {
  "login" : "playchat",
  "avatar_url" : "",
  "type" : "admin",
  "email" : "[email protected]",
  "location" : "",
  "confirmed" : true,
  "created_at" : 1432441527583,
  "updated_at" : 1432441527583
} ]

Update the authenticated user

You must pass authentication information with your request.

Parameters
Field Type Description
location String The user-defined location for this account’s profile. Not necessarily a location nor parseable.
Nullable.
Valid length range: 0 - 100.
Example: "location": "playchat"
Request
Route
PUT /user
Body
{
  "location": "playchat"
}
Response
Status
200 OK
Body
{
  "login": "playchat",
  "avatar_url": "",
  "type": "user",
  "email": "[email protected]",
  "location": "", 
  "confirmed": true, 
  "created_at": 1432441527583,
  "updated_at": 1432441527583
}