Created
November 5, 2012 20:25
-
-
Save facultymatt/4020143 to your computer and use it in GitHub Desktop.
Poasty API response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// input standards | |
// --- | |
// use school id instead of literal strings | |
// when a user logs in, the App sends user info and device token | |
// the api responds with auth code, user object, and school id | |
// | |
// security concerns | |
// - ssl cert and changing calls to https | |
// - security on iPhone | |
// response standards | |
"meta": { | |
// standardize error and success, ie: 200, 400, 401, etc. | |
// we are not returning status | |
"code": "…", | |
// if we don't get 200, this message expalins error in detail | |
// mainly to help developer debug the error | |
"error_detail": "…", | |
// message to user | |
"message": "...", | |
// array of errors, each error is an object | |
"validation_errors": [ | |
{ | |
"field_name" => "...", | |
"message_to_user" => "..." | |
}, | |
{ | |
"field_name" => "...", | |
"message_to_user" => "..." | |
} | |
], | |
}, | |
"activity" { | |
// array of badge objects | |
"counts" : { | |
"hearts_received", | |
"comments_received", | |
"posts_made" | |
}, | |
"new_points" : 23354, | |
"items" : [ | |
{ | |
"type" => "badge", | |
"created", | |
"data" { | |
"title", | |
"desc", | |
"image", | |
"point_value" | |
} | |
}, | |
{ | |
"type" => "heart", | |
"created", | |
"data" { | |
"desc", | |
"point_value", | |
"post_id", | |
"user" { | |
// user object | |
} | |
} | |
} | |
] | |
}, | |
// this is the main data we are looking for with the api call, | |
// ie: an array of users, array of posts, user profile object, etc. | |
"response": { | |
// array | |
"posts" : [ | |
{ | |
"id", | |
"blurb", | |
"photo", | |
"user" : { | |
"fname", | |
"lname", | |
//etc | |
} | |
} | |
] | |
}, | |
"pagination": { | |
"next_url": "...", | |
"prev_url": "…", | |
"limit": "…", | |
"offset": "…", | |
"total_count": "…" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment