POST /v1/api/users/login
Parameter | Type | Description | Required |
---|---|---|---|
user | Object | a user | yes |
user.email | String | email address | yes |
user.password | String | password | yes |
{
"user":{
"email": "[email protected]",
"password": "zaccoding"
}
}
Status: 200 OK
{
"code": 200,
"expire": "2020-09-23T00:09:36.1524+09:00",
"meta": "meta",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDA3ODczNzYsImlkIjoiYWRtaW5AZW1haWwuY29tIiwib3JpZ19pYXQiOjE2MDA3ODcyODl9.AIoE8jlM68l05l4be0irTo6-0fw1nbBIINDJhLDJ0IY"
}
POST /v1/api/users
Parameter | Type | Description | Required |
---|---|---|---|
user | Object | a user | yes |
user.username | String | name | yes |
user.email | String | email address | yes |
user.password | String | password | yes |
{
"user":{
"username": "zaccoding",
"email": "[email protected]",
"password": "zaccoding"
}
}
Status: 201 Created
{
"user": {
"username": "zaccoding",
"email": "[email protected]",
"bio": "",
"image": ""
}
}
GET /v1/api/user/me
Authentication required.
Status: 200 OK
{
"user": {
"username": "zaccoding",
"email": "[email protected]",
"bio": "",
"image": ""
}
}
PUT /v1/api/user
Authentication required.
Parameter | Type | Description | Required |
---|---|---|---|
user | Object | User's object | no |
user.username | String | user name | no |
user.password | String | password | no |
user.bio | String | biography | no |
user.image | String | image url | no |
{
"user": {
"bio": "I like coding"
}
}
Status: 200 OK
{
"user": {
"username": "zaccoding",
"email": "[email protected]",
"bio": "I like coding",
"image": ""
}
}
POST /v1/api/articles
Authentication required.
Parameter | Type | Description | Required |
---|---|---|---|
article | Object | article's object | yes |
article.title | String | title | yes |
article.body | String | body | yes |
article.tags | Array | article's tags | no |
{
"article": {
"title": "How to train your dragon",
"body": "You have to believe",
"tagList": ["reactjs", "angularjs", "dragons"]
}
}
Status: 201 Created
{
"article": {
"slug": "how-to-train-your-dragon",
"title": "How to train your dragon",
"body": "It takes a Jacobian",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}
}
GET /v1/api/articles/:slug
Authentication required.
Parameter | Description |
---|---|
slug | article's slug |
Status: 200 OK
{
"article": {
"slug": "how-to-train-your-dragon",
"title": "How to train your dragon",
"body": "It takes a Jacobian",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}
}
GET /v1/api/articles?tag=AngularJS&author=zaccoding&limit=20&offset=0
Parameter | Type | Description | Default |
---|---|---|---|
tag | Array | filter by tag | none |
author | String | filter by author | none |
limit | Numeric | limit number of articles | 5 |
offset | Numeric | skip number of articles | 0 |
Status: 200 OK
{
"articles":[{
"slug": "how-to-train-your-dragon",
"title": "How to train your dragon",
"body": "It takes a Jacobian",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}, {
"slug": "how-to-train-your-dragon-2",
"title": "How to train your dragon 2",
"body": "It a dragon",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}],
"articlesCount": 2
}
DELETE /v1/api/articles/:slug
Authentication required
Parameter | Description |
---|---|
slug | article's slug |
Status: 200 OK
POST /v1/api/articles/:slug/comments
Authentication required.
Parameter | Description |
---|---|
slug | article's slug |
Parameter | Type | Description | Required |
---|---|---|---|
comment | Object | comment object | yes |
comment.body | String | content | yes |
{
"comment": {
"body": "His name was my name too."
}
}
Status: 201 Created
{
"comment": {
"id": 1,
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:22:56.637Z",
"body": "It takes a Jacobian",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}
}
GET /v1/api/articles/:slug/comments
Parameter | Description |
---|---|
slug | article's slug |
Status: 200 OK
{
"comments": [{
"id": 1,
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:22:56.637Z",
"body": "It takes a Jacobian",
"author": {
"username": "jake",
"bio": "I work at statefarm",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}]
}
DELETE /v1/api/articles/:slug/comments/:id
Authentication required.
Parameter | Description |
---|---|
slug | article's slug |
id | comment's id |
Status: 200 OK