mini-wp

http://miniwp.alvinatjia.com/


Create a User

  • URL </users/register>

  • Method: POST

  • URL Params
    None

  • Data Params Required:

    name=[string]
    email=[string]
    password=[string]

    Optional: image=[string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/users/register",
        "data": {
            "name": "John Doe",
            "email": "john@mail.com",
            "password": "PASSWORD"
        }
    })
  • Success Response:

    • Code: 201
      Content:
          {
              "_id": "5e1d913661b76e27891d5170",
              "name": "John Doe",
              "email": "john@mail.com",
              "image": "https://ui-avatars.com/api/?name=John Doe&size=512",
              "createdAt": "2020-01-14T10:00:22.669Z",
              "updatedAt": "2020-01-14T10:00:22.669Z"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "This email john@mail.com has already been used!" }
    • Code: 500 Internal Server Error
      Content: { error : "" }

Log In

  • URL </users/login>

  • Method: POST

  • URL Params
    None

  • Data Params Required:

    email=[string]
    password=[string]

  • Sample Request:

        axios({
            "method": "POST",
            "url": "http://{HOST}.com/users/login",
            "data": {
                "email": "jane@mail.com",
                "password": "PASSWORD"
            }
        })
  • Success Response:

    • Code: 200
      Content:
      {
          "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMWQ5MWE3NjFiNzZlMjc4OTFkNTE3MSIsImVtYWlsIjoiamFuZUBtYWlsLmNvbSIsImlhdCI6MTU3ODk5NjE0NCwiZXhwIjoxNTc4OTk5NzQ0fQ.mc6_-Bq1JK2j7S7bDk0HDleJ9bzwT-sZhbAdy2q-uyU"
      }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Email and/or password incorrect" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Find user by ID

  • URL </users/{ID}>

  • Method: GET

  • URL Params
    email=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

        axios({
            "method": "GET",
            "url": "http://{HOST}.com/users/5e186c14af790e1a58535cdd",
            "headers": {
                "access_token": "YOUR_ACCESS_TOKEN"
            }
        })
  • Success Response:

    • Code: 200
      Content:
      {
          "_id": "5e15fe2ed406f210996d4f6a",
          "name": "John Doe",
          "email": "john@mail.com",
          "image": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png",
          "createdAt": "2020-01-08T16:07:10.388Z",
          "updatedAt": "2020-01-08T16:07:10.388Z"
      }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Invalid Access" }
    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 404 Not Found
      Content: { error : "User not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Get all articles in database

  • URL </articles>

  • Method: GET

  • URL Params
    None

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/articles",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "image": "https://lp-cms-production.imgix.net/2019-06/GettyImages-149353949_high.jpg?fit=crop&q=40&sharp=10&vib=20&auto=format&ixlib=react-8.6.4",
              "tags": [],
              "likes": [],
              "comments": [],
              "_id": "5e1d9dcd6eb4423d8a9f8c39",
              "title": "My Trip to Himachal Pradesh",
              "content": "Life has several moments of impact in stock. The last and the most tremendous of all those moments are considerably our last one. I would beg to differ. A recent study shows that the human brain remains active for seven minutes after the heart stops, going through its most precious keepsake: the memory bag.\n\nTHAT for me will be seven minutes filled with impacts. That is what I decided I would live my life for, collecting as many memories, as many moments, as many feelings in as many places as I possibly can, all for those last seven minutes.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:54:05.444Z",
              "updatedAt": "2020-01-14T10:54:05.444Z"
          },
          {
              "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
              "tags": [],
              "likes": [],
              "comments": [],
              "_id": "5e1d9e716eb4423d8a9f8c3a",
              "title": "Summer in Osaka",
              "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:56:49.911Z",
              "updatedAt": "2020-01-14T10:56:49.911Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Get all logged in user's articles

  • URL </articles/all/own>

  • Method: GET

  • URL Params
    None

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/articles/all/own",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
              "tags": [],
              "likes": [],
              "comments": [],
              "_id": "5e1d9e716eb4423d8a9f8c3a",
              "title": "Summer in Osaka",
              "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:56:49.911Z",
              "updatedAt": "2020-01-14T10:56:49.911Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Get an article

  • URL </articles/{id}>

  • Method: GET

  • URL Params
    id=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/articles/5e1d9e716eb4423d8a9f8c3a",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
              "tags": [],
              "likes": [],
              "comments": [],
              "_id": "5e1d9e716eb4423d8a9f8c3a",
              "title": "Summer in Osaka",
              "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:56:49.911Z",
              "updatedAt": "2020-01-14T10:56:49.911Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 403 Forbidden
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Article not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Create an article

  • URL </articles>

  • Method: POST

  • URL Params
    access_token=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params Required: title=[string]
    content=[string]

    Optional: image=[string]
    tags=[array of string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/articles",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "title": "My Trip to Himachal Pradesh",
            "content": "Life has several moments of impact in stock. The last and the most tremendous of all those moments are considerably our last one. I would beg to differ. A recent study shows that the human brain remains active for seven minutes after the heart stops, going through its most precious keepsake: the memory bag. THAT for me will be seven minutes filled with impacts. That is what I decided I would live my life for, collecting as many memories, as many moments, as many feelings in as many places as I possibly can, all for those last seven minutes.",
            "image": "https://lp-cms-production.imgix.net/2019-06/GettyImages-149353949_high.jpg?fit=crop&q=40&sharp=10&vib=20&auto=format&ixlib=react-8.6.4"
        }
    })
  • Success Response:

    • Code: 201
      Content:
          {
              "image": "https://lp-cms-production.imgix.net/2019-06/GettyImages-149353949_high.jpg?fit=crop&q=40&sharp=10&vib=20&auto=format&ixlib=react-8.6.4",
              "tags": [],
              "likes": [],
              "comments": [],
              "_id": "5e1d9ced6eb4423d8a9f8c38",
              "title": "My Trip to Himachal Pradesh",
              "content": "Life has several moments of impact in stock. The last and the most tremendous of all those moments are considerably our last one. I would beg to differ. A recent study shows that the human brain remains active for seven minutes after the heart stops, going through its most precious keepsake: the memory bag.\n\nTHAT for me will be seven minutes filled with impacts. That is what I decided I would live my life for, collecting as many memories, as many moments, as many feelings in as many places as I possibly can, all for those last seven minutes.",
              "author": "5e1d913661b76e27891d5170",
              "createdAt": "2020-01-14T10:50:21.694Z",
              "updatedAt": "2020-01-14T10:50:21.694Z"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Article's name is required" }
    • Code: 403 Forbidden
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Filter articles by tag

  • URL </articles/filter/{tag}>

  • Method: GET

  • URL Params
    tag=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/articles/filter/travel",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "image": "https://lp-cms-production.imgix.net/2019-06/GettyImages-149353949_high.jpg?fit=crop&q=40&sharp=10&vib=20&auto=format&ixlib=react-8.6.4",
              "tags": ["travel"],
              "likes": [],
              "comments": [],
              "_id": "5e1d9dcd6eb4423d8a9f8c39",
              "title": "My Trip to Himachal Pradesh",
              "content": "Life has several moments of impact in stock. The last and the most tremendous of all those moments are considerably our last one. I would beg to differ. A recent study shows that the human brain remains active for seven minutes after the heart stops, going through its most precious keepsake: the memory bag.\n\nTHAT for me will be seven minutes filled with impacts. That is what I decided I would live my life for, collecting as many memories, as many moments, as many feelings in as many places as I possibly can, all for those last seven minutes.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:54:05.444Z",
              "updatedAt": "2020-01-14T10:54:05.444Z"
          },
          {
              "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
              "tags": ["travel"],
              "likes": [],
              "comments": [],
              "_id": "5e1d9e716eb4423d8a9f8c3a",
              "title": "Summer in Osaka",
              "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:56:49.911Z",
              "updatedAt": "2020-01-14T10:56:49.911Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Search articles by title

  • URL </articles/search/{title}>

  • Method: GET

  • URL Params
    title=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/articles/search/sum",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
              "tags": ["travel"],
              "likes": [],
              "comments": [],
              "_id": "5e1d9e716eb4423d8a9f8c3a",
              "title": "Summer in Osaka",
              "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
              "author": {
                  "_id": "5e1d913661b76e27891d5170",
                  "name": "John Doe",
                  "email": "john@mail.com",
                  "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
              },
              "createdAt": "2020-01-14T10:56:49.911Z",
              "updatedAt": "2020-01-14T10:56:49.911Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Edit an article

  • URL </articles/{id}>

  • Method: PUT

  • URL Params
    id=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    Optional: title=[string]
    content=[string]
    image=[string]
    array of strings=[string]

  • Sample Request:

    axios({
        "method": "PUT",
        "url": "http://{HOST}.com/articles/5e1d9e716eb4423d8a9f8c3a",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "title": "Osaka Trip"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      {
          "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
          "tags": [],
          "likes": [],
          "comments": [],
          "_id": "5e1d9e716eb4423d8a9f8c3a",
          "title": "Osaka Trip",
          "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
          "author": {
              "_id": "5e1d913661b76e27891d5170",
              "name": "John Doe",
              "email": "john@mail.com",
              "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
          },
          "createdAt": "2020-01-14T10:56:49.911Z",
          "updatedAt": "2020-01-14T10:56:49.911Z"
      }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 403 Forbidden
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Article not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Delete an article

  • URL </articles/{id}>

  • Method: DELETE

  • URL Params
    id=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "DELETE",
        "url": "http://{HOST}.com/articles/5e1d9e716eb4423d8a9f8c3a",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      {
        "Article with ID 5e1d9e716eb4423d8a9f8c3a successfully deleted"
      }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 403 Forbidden
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Article not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Like an article

  • URL </articles/{id}/likes>

  • Method: PATCH

  • URL Params
    id=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "PATCH",
        "url": "http://{HOST}.com/articles/5e1d9e716eb4423d8a9f8c3a/likes",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      {
          "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
          "tags": [],
          "likes": ["5e1d913661b76e27891d5170"],
          "comments": [],
          "_id": "5e1d9e716eb4423d8a9f8c3a",
          "title": "Osaka Trip",
          "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
          "author": {
              "_id": "5e1d913661b76e27891d5170",
              "name": "John Doe",
              "email": "john@mail.com",
              "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
          },
          "createdAt": "2020-01-14T10:56:49.911Z",
          "updatedAt": "2020-01-14T10:56:49.911Z"
      }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 404 Not Found
      Content: { error : "Article not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Comment an article

  • URL </articles/{id}/comments>

  • Method: POST

  • URL Params
    id=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    Required: comment=[string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/articles/5e1d9e716eb4423d8a9f8c3a/comments",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
          "comment": "Nice article!"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      {
          "image": "https://japanstartshere.com/wp-content/uploads/2019/09/Okinawa-Japan-Day-Trip.jpg",
          "tags": [],
          "likes": ["5e1d913661b76e27891d5170"],
          "comments": ["Nice article!"],
          "_id": "5e1d9e716eb4423d8a9f8c3a",
          "title": "Osaka Trip",
          "content": "Osaka can be a neon nightmare on a hot, sunny day—and sometimes the last thing you want is to find yourself on packed, sweaty city streets. Luckily the hub has plenty of stunning spots you can escape to, from beaches to forest-covered mountains, all within perfect reach of the day-tripper. There are waterfall hikes, canalside towns and abandoned railway tracks that all deserve a visit, so grab your supplies and get exploring on these summer day trips from Osaka.",
          "author": {
              "_id": "5e1d913661b76e27891d5170",
              "name": "John Doe",
              "email": "john@mail.com",
              "image": "https://ui-avatars.com/api/?name=John Doe&size=512"
          },
          "createdAt": "2020-01-14T10:56:49.911Z",
          "updatedAt": "2020-01-14T10:56:49.911Z"
      }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 404 Not Found
      Content: { error : "Article not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }