Blog

API Endpoint

Articles

Add Article

POST /api/articles
Requests200422
Headers
Content-Type: application/json
X-Access-Token: 4d2209c04acc10ddc6c1fae0eedef1bd
Body
{
  "article": {
    "title": "Pasta Carbonara",
    "description": "Fresh parsley, Italian sausage, shallots, garlic, sun-dried tomatoes and mozzarella cheese in an all-butter crust. With a side of mixed fruits."
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "id": 6,
  "title": "Pasta Carbonara",
  "description": "Fresh parsley, Italian sausage, shallots, garlic, sun-dried tomatoes and mozzarella cheese in an all-butter crust. With a side of mixed fruits.",
  "author_id": 14,
  "state": null,
  "created_at": "2020-07-06T12:38:54.927Z",
  "updated_at": "2020-07-06T12:38:54.927Z"
}
Headers
Content-Type: application/json
X-Access-Token: 8dd9181584012ad887a290a7f4cd155e
Body
{
  "article": {
    "title": "",
    "description": "Two buttermilk waffles, topped with whipped cream and maple syrup, a side of two eggs served any style, and your choice of smoked bacon or smoked ham."
  }
}
Responses422
Headers
Content-Type: application/json
Body
{
  "article": [
    "Title can't be blank"
  ]
}

Create Article
POST/api/articles

URI Parameters
HideShow
title
string (required) Example: Awesome title

Title

description
string (required) 

Description

state
string (optional) 

State


Get Article

GET /api/articles/123
Requests200
Headers
Content-Type: application/json
X-Access-Token: dd6f13f19dba726038e37b178efcce40
Responses200
Headers
Content-Type: application/json
Body
{
  "id": 7,
  "title": "California Maki",
  "description": "Three egg whites with spinach, mushrooms, caramelized onions, tomatoes and low-fat feta cheese. With herbed quinoa, and your choice of rye or whole-grain toast.",
  "author_id": 16,
  "state": null,
  "created_at": "2020-07-06T12:38:54.947Z",
  "updated_at": "2020-07-06T12:38:54.947Z"
}

Get Article
GET/api/articles/{id}

URI Parameters
HideShow
id
integer (required) Example: 123

Article ID


Update Article

PUT /api/articles/100
Requests200422
Headers
Content-Type: application/json
X-Access-Token: eac3b286e38470d3785227a8029a174b
Body
{
  "article": {
    "title": "Awesome Blog"
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "title": "Awesome Blog",
  "id": 8,
  "author_id": 17,
  "description": "Breaded fried chicken with waffles, and a side of maple syrup.",
  "state": null,
  "created_at": "2020-07-06T12:38:54.957Z",
  "updated_at": "2020-07-06T12:38:54.963Z"
}
Headers
Content-Type: application/json
X-Access-Token: c67b518b001c061c7db13edbe3464ff5
Body
{
  "article": {
    "title": ""
  }
}
Responses422
Headers
Content-Type: application/json
Body
{
  "article": [
    "Title can't be blank"
  ]
}

Update Article
PUT/api/articles/{id}

URI Parameters
HideShow
id
integer (required) Example: 100

Article id


Delete Article

DELETE /api/articles/100
Requests200404
Headers
Content-Type: application/json
X-Access-Token: 05af14ebb35983d868df64c18d154f2b
Responses200
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
X-Access-Token: 48edb7d37656f4038ba8675263f44c53
Responses404
Headers
Content-Type: application/json
Body
{
  "user": "Couldn't find Article with 'id'=0"
}

Delete User
DELETE/api/articles/{id}

URI Parameters
HideShow
id
integer (required) Example: 100

Article id


Users

Add User

POST /api/users
Requests200422
Headers
Content-Type: application/json
Body
{
  "user": {
    "name": "Surendra",
    "email": "user@test.com",
    "password": "Apple123",
    "password_confirmation": "Apple123"
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "id": 21,
  "name": "Surendra",
  "email": "user@test.com",
  "password_digest": "$2a$04$6oZ9Ql2m1M9bshvXzjGoxOZkK3jxUY4m0Cbsmqp8Kftbt1.8XdDO2",
  "authentication_token": "235e9e8604815f383eb7a6774bb00a3c",
  "created_at": "2020-07-06T12:38:55.045Z",
  "updated_at": "2020-07-06T12:38:55.045Z"
}
Headers
Content-Type: application/json
Body
{
  "user": {
    "name": "Surendra",
    "email": ""
  }
}
Responses422
Headers
Content-Type: application/json
Body
{
  "user": [
    "Password can't be blank",
    "Password is too short (minimum is 6 characters)",
    "Email can't be blank",
    "Email is not an email"
  ]
}

Create User
POST/api/users

URI Parameters
HideShow
name
string (required) Example: John Wick

User name

email
string (required) Example: user@test.com

User email

password
string (required) 

User password

password_confirmation
string (required) 

password confirmation


Get User

GET /api/users/123
Requests200
Headers
Content-Type: application/json
Responses200
Headers
Content-Type: application/json
Body
{
  "id": 22,
  "name": "Renato Dach DDS",
  "email": "email-8@example.com",
  "password_digest": "$2a$04$wQNSUeXqKoVln.xJZNV3uusxVu5ibgkcKJDY/2KO80x26afeL8yZm",
  "authentication_token": "895a95e0d2350bd5195b7e45a1ae2d9f",
  "created_at": "2020-07-06T12:38:55.072Z",
  "updated_at": "2020-07-06T12:38:55.072Z"
}

Get User
GET/api/users/{id}

URI Parameters
HideShow
id
integer (required) Example: 123

User ID


Update User

PUT /api/users/100
Requests200422
Headers
Content-Type: application/json
X-Access-Token: 174583c3aeb4067d4f443650af7c4970
Body
{
  "user": {
    "name": "Surendra K"
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "name": "Surendra K",
  "id": 23,
  "password_digest": "$2a$04$CAvPCpUUEpE4LlD3vHORdeVnBrjEGIJwC44MKgidk12nPTVk5.qx2",
  "email": "email-9@example.com",
  "authentication_token": "174583c3aeb4067d4f443650af7c4970",
  "created_at": "2020-07-06T12:38:55.080Z",
  "updated_at": "2020-07-06T12:38:55.085Z"
}
Headers
Content-Type: application/json
X-Access-Token: 3eaba6f77fb5a8e8fae7a04a1c0a7137
Body
{
  "user": {
    "email": ""
  }
}
Responses422
Headers
Content-Type: application/json
Body
{
  "user": [
    "Email can't be blank",
    "Email is not an email"
  ]
}

Update User
PUT/api/users/{id}

URI Parameters
HideShow
id
integer (required) Example: 100

User id


Delete User

DELETE /api/users/100
Requests200404
Headers
Content-Type: application/json
X-Access-Token: bdbcb2e2b8c3434baf5ddfb4d139d4d9
Responses200
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
X-Access-Token: bf7f11cc8334549027eb608c63797c30
Responses404
Headers
Content-Type: application/json
Body
{
  "user": "Couldn't find User with 'id'=0"
}

Delete User
DELETE/api/users/{id}

URI Parameters
HideShow
id
integer (required) Example: 100

User id


Generated by aglio on 06 Jul 2020