Authorization: jwt.token.here
{
"profile": {
"id": 1,
"name": "djkhaled",
"email": "[email protected]",
"url": "imgur.com/sjjcu88",
"you_follow": true,
"follows_you": false,
"following": 200,
"followers": 100
}
}
{
"auth": {
"jwt": "<YOUR JWT TOKEN>"
}
}
{
"post": {
"id": 1,
"slug": "the-keys-to-success",
"title": "The Keys To Success",
"url": "imgur.com/dg26gs",
"tagList": ["djkhaled", "asahd", "major keys"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"liked": false,
"likes": 234,
"author": {
"id": 1,
"name": "djkhaled",
"email": "[email protected]",
"you_follow": true,
"follows_you": false,
"following": 200,
"followers": 100
}
}
}
{
"posts":[{
"id": 1,
"slug": "the-keys-to-success",
"title": "The Keys To Success",
"url": "imgur.com/dg26gs",
"tagList": ["djkhaled", "asahd", "major keys"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"liked": false,
"likes": 234,
"author": {
"id": 1,
"name": "djkhaled",
"email": "[email protected]",
"you_follow": true,
"follows_you": false,
"following": 200,
"followers": 100
}
},
{
"id": 2,
"slug": "has-the-drake-vocals-come-in-yet",
"title": "Has The Drake Vocals Come In Yet",
"url": "imgur.com/dg26gs",
"tagList": ["djkhaled", "asahd", "major keys", "grateful"],
"createdAt": "2016-07-18T03:22:56.637Z",
"updatedAt": "2016-07-18T03:48:35.824Z",
"liked": false,
"likes": 264,
"author": {
"id": 1,
"name": "djkhaled",
"email": "[email protected]",
"you_follow": true,
"follows_you": false,
"following": 200,
"followers": 100
}
}
],
"count": 2
}
{
"tags": [
"djkhaled",
"asahd",
"drake"
]
}
If a request fails any validations, expect a 422 and errors in the following format:
{
"errors":{
"body": [
"can't be empty"
]
}
}
401 for Unauthorized requests, when a request requires authentication but it isn't provided
403 for Forbidden requests, when a request may be valid but the user doesn't have permissions to perform the action
404 for Not found requests, when a resource can't be found to fulfill the request
POST /api/v1/token
Example request body:
{
"user":{
"email": "[email protected]",
"password": "ILOVEYOUASAHD"
}
}
No authentication required, returns a User
Required fields: email
, password
POST /api/v1/users
Example request body:
{
"user":{
"name": "djkhaled",
"email": "[email protected]",
"password": "ILOVEYOUASAHD",
"url": "imgur.com/sjjcu88"
}
}
No authentication required, returns a User
Required fields: email
, name
, password
Optional fields: url
GET /api/v1/user
Authentication required, returns a User that's the current user
PUT /api/v1/user
Example request body:
{
"user":{
"name": "djkhaledmusic"
}
}
Authentication required, returns the User
Accepted fields: email
, name
, password
, url
GET /api/v1/profiles
Authentication optional, returns a list of all profiles
GET /api/v1/profiles/:username
Authentication optional, returns a Profile
GET /api/v1/profiles/:username/followers
Authetication optional, returns lists of profile who follow :username
GET /api/v1/profiles/:username/following
Authetication optional, returns lists of profile whom :username follow
POST /api/v1/profiles/:username/follow
Authentication required, returns a Profile
No additional parameters required
DELETE /api/v1/profiles/:username/follow
Authentication required, returns a Profile
No additional parameters required
GET /api/v1/posts
Returns most recent posts globally by default, provide tag
, author
or liked
query parameter to filter results
Query Parameters:
Filter by tag:
?tag=memes
Filter by author:
?author=djkhaled
Liked by user:
?liked=asahdkhaled
Limit number of posts (default is 25):
?limit=20
Offset/skip number of posts (default is 0):
?offset=0
Authentication optional, will return multiple posts
GET /api/v1/posts/feed
Can also take limit
and offset
query parameters like List posts
Authentication required, will return multiple posts created by followed users
GET /api/v1/posts/:slug
No authentication required, will return single Post
POST /api/v1/posts
Example request body:
{
"Post": {
"title": "The key is to believe. smh",
"url": "imgur.com/5f4dd",
"tagList": ["khaledquotes", "djkhaled", "wethebest"]
}
}
Authentication required, will return an Post
Required fields: title
, url
Optional fields: tagList
as an array of Strings
PUT /api/v1/posts/:slug
Example request body:
{
"Post": {
"title": "MY SON ASAHD"
}
}
Authentication required, returns the updated Post
Optional fields: title
, url
The slug
also gets updated when the title
is changed
DELETE /api/v1/posts/:slug
Authentication required
GET /api/v1/posts/liked
Authentication required. returns list of liked posts by current user
POST /api/v1/posts/:slug/vote
Authentication required, returns the Post
No additional parameters required
DELETE /api/v1/posts/:slug/vote
Authentication required, returns the Post
No additional parameters required
GET /api/v1/tags
No authentication required, returns a List of Tags