fatch api on this url
http://artus-api.herokuapp.com/api/v1
Authorization: Token jwt.token.here
Make sure the right content type like Content-Type: application/json; charset=utf-8
is correctly returned.
{
"user": {
"email": "rajesh@rajesh.com",
"token": "jwt.token.here",
"username": "rajesh",
"bio": "learn to code",
"image": null
}
}
{
"profile": {
"username": "rajesh",
"bio": "learn to code",
"image": "sample.jpg",
"following": false
}
}
{
"article": {
"slug": "learn-html",
"title": "learn html whith rupali",
"description": "learn html",
"body": "only html",
"tagList": [
"Html",
"ui",
"front-end"
],
"createdAt": "2020-03-02T14:30:33.997Z",
"updatedAt": "2020-03-02T16:54:09.736Z",
"favorited": false,
"author": {
"username": "rupali",
"bio": "I like to code.",
"following": []
}
}
}
{
"articles":[{
"slug": "learn-html",
"title": "learn html whith rupali",
"description": "learn html",
"body": "only html",
"tagList": [
"Html",
"ui",
"front-end"
],
"createdAt": "2020-03-02T14:30:33.997Z",
"updatedAt": "2020-03-02T16:54:09.736Z",
"favorited": false,
"author": {
"username": "rupali",
"bio": "I like to code.",
"following": []
}
}, {
"slug": "learn-html",
"title": "learn html whith rupali",
"description": "learn html",
"body": "only html",
"tagList": [
"Html",
"ui",
"front-end"
],
"createdAt": "2020-03-02T14:30:33.997Z",
"updatedAt": "2020-03-02T16:54:09.736Z",
"favorited": false,
"author": {
"username": "rupali",
"bio": "I like to code.",
"following": []
}
}],
"articlesCount": 2
}
{
"comment": {
"id": "5e5d35745c006c22c513045a",
"body": "Goog Article 10 03",
"createdAt": "2020-03-02T16:33:56.987Z",
"updatedAt": "2020-03-02T16:33:56.987Z",
"author": {
"username": "rulpali",
"bio": "I like to code.",
"following": []
}
}
}
{
"comments": [{
"id": "5e5d35745c006c22c513045a",
"body": "Goog Article 10 03",
"createdAt": "2020-03-02T16:33:56.987Z",
"updatedAt": "2020-03-02T16:33:56.987Z",
"author": {
"username": "rulpali",
"bio": "I like to code.",
"following": []
}
}]
}
{
"tags": [
"html",
"css"
]
}
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 /users/login
Example request body:
{
"user":{
"email": "rajesh@rajesh.com",
"password": "rajesh"
}
}
No authentication required, returns a User
Required fields: email
, password
POST /users
Example request body:
{
"user":{
"username": "rajesh",
"email": "rajesh@rajesh.com",
"password": "rajesh"
}
}
No authentication required, returns a User
Required fields: email
, username
, password
GET /user
Authentication required, returns a User that's the current user
PUT /user
Example request body:
{
"user":{
"email": "rajesh@rajesh.com",
"bio": "I like to code",
"image": "https://i.stack.imgur.com/xHWG8.jpg"
}
}
Authentication required, returns the User
Accepted fields: email
, username
, password
, image
, bio
GET /profiles/:username
Authentication optional, returns a Profile
POST /profiles/:username/follow
Authentication required, returns a Profile
No additional parameters required
DELETE /profiles/:username/follow
Authentication required, returns a Profile
No additional parameters required
GET /articles
Returns most recent articles globally by default, provide tag
, author
or favorited
query parameter to filter results
Query Parameters:
Filter by tag:
?tag=AngularJS
Filter by author:
?author=jake
Favorited by user:
?favorited=jake
Limit number of articles (default is 20):
?limit=20
Offset/skip number of articles (default is 0):
?offset=0
Authentication optional, will return multiple articles, ordered by most recent first
GET /articles/feed
Can also take limit
and offset
query parameters like List Articles
Authentication required, will return multiple articles created by followed users, ordered by most recent first.
GET /articles/:slug
No authentication required, will return single article
POST /articles
Example request body:
{
"article": {
"title": "Learn css",
"description": "learn css",
"body": "only css",
"tagList": [
"Html",
"css",
"ui",
"front-end"
]
}
}
Authentication required, will return an Article
Required fields: title
, description
, body
Optional fields: tagList
as an array of Strings
PUT /articles/:slug
Example request body:
{
"article": {
"title": "Learn html css"
}
}
Authentication required, returns the updated Article
Optional fields: title
, description
, body
The slug
also gets updated when the title
is changed
DELETE /articles/:slug
Authentication required
POST /articles/:slug/comments
Example request body:
{
"comment": {
"body": "His name was my name too."
}
}
Authentication required, returns the created Comment
Required field: body
GET /articles/:slug/comments
Authentication optional, returns multiple comments
DELETE /articles/:slug/comments/:id
Authentication required
POST /articles/:slug/favorite
Authentication required, returns the Article
No additional parameters required
DELETE /articles/:slug/favorite
Authentication required, returns the Article
No additional parameters required
GET /tags
No authentication required, returns a List of Tags