You're viewing old version number 66. - Current version

2 min

Kinglet API

Each function is preceded with /api/v1.

Messages

Each URI ends with a query string /?user_name=[user_name]&user_id=[user_id]&session_id=[session_id.

example displaying message number 5:
GET /api/v1/messages/5/ru8er03jjg3k40vjl09/23/JR

[X] GET /messages - homepage. stream. messages created by or sent to the logged in user.

[X] GET /messages/page/3 - page three of the stream.

[X] GET /messages/since/[date] - for the logged-in user, get all new messages received since the supplied date, which is in epoch seconds.

[X] GET /messages/5 - retrieve message 5.

[X] POST /messages - create a new message.

[X] GET /messages/5/replies - retrieve all reply messages for message 5.

[X] POST /messages/5/replies - create a reply message to message 5.

[X] GET /messages/threads - list the messages that start new discussions.

Users

# = URI ends with a query string /?user_name=[user_name]&user_id=[user_id]&session_id=[session_id.

[X] GET /users/JR - retrieve user info for user name JR. #

[X] POST /users - create a new user account.

[X] GET /users/activate/[user_digest] - activate user account

[X] GET /users/JR/logout - logout user JR. #

[X] POST /users/login - login user.

[X] POST /users/password - retrieve new password for existing account. user would not be logged in. this would be executed for someone who forgot or lost password.

[X] PUT /users/password - change password for existing account. user must be logged-in. #

[X] PUT /users - update e-mail and/or profile description for the user #

User actions:
- X create account
- X activate account
- X login
- logout
- change password
- change e-mail and profile description
- request new password
- retrieve user profile info

Message actions:
- get user's stream of all messages (sent and received)
- get user's new messages received since supplied date
- get single message
- create a new message
- retrieve all replies for a message
- create a reply to a particular message
- list the new messages that start a discussion thread

Returned JSON

Create New User Account

{
  "status"       :  201,
  "user_id"      :  "9",
  "user_name"    :  "1389906958",
  "password"     :  "khd7vj4m",
  "email"        :  "1389906958@test.com",
  "user_digest"  :  "p7X4CwwLSuqD2bjYIATcw",
  "description"  :  "Created"
}

Activate Account

{
    "status"       :  200,
    "description"  :  "OK"
}

Log In

{
    "status"      :  200,
    "user_id"     :  "17",
    "user_name"   :  "kinglettest1389911089",
    "session_id"  :  "LUb83Dw38nnqMOI47NVZw"
}

Successfully Change Password

{
    "session_id"  :  "3Ms41qwZfjuHW2kUmNeOg",
    "status"      :  200,
    "user_id"     :  "20",
    "user_name"   :  "kinglettest1389912835"
}

Unsuccessfully Changed Password

{
    "status"          :  "400",
    "description"     :  "Bad Request",
    "user_message"    :  "Old password is incorrect.",
    "system_message"  :  "Try again. oldpwd=ykboQdwz7h0qXrPoUJKGaw - pwd=9gz3Ijf8GhCdFCqsma+dvw - olddig=AVQk3qoFBzn2yrbEIVVA - digest=5BYzikIRrokcaEQmGIeSA"
}

#kinglet - #api - #programming

From JR's : articles
417 words - 3037 chars - 2 min read
created on
updated on - #
source - versions

Related articles
Draftin.com WebHook URL info - Aug 09, 2013
Kinglet API - Mar 07, 2014
Forecast.io becomes darksky.net in sep 2016 - Sep 21, 2016
Web-based publishing platforms that I've created - Mar 03, 2015
Reuters' former Next Web system - Sep 19, 2013
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Nov 15, 2024 - 6:58 a.m. EST