Coder Social home page Coder Social logo

blog-api's Introduction

blog-api

API End Points

Usage

Goto Section

For Sign Up

Make POST Request for sign up on End Point - https://blog-api-tanixq.herokuapp.com/api/users/signup

Provide Following data in body

Fields Description TYPE Required
firstName First Name of the user String Yes
lastName Last Name of the user String Yes
email Email of the user. String Yes
password Password of the user. Must be of 8 characters. String Yes
bio bio of the user. Max 160 characters. String optional
profilePicture profile picture of user. file optional

For Login

Make POST Request for login on End Point - https://blog-api-tanixq.herokuapp.com/api/users/login

Provide Following data in body

Fields Description TYPE Required
email Email of the user. String Yes
password Password of the user. String Yes

Example :-

{
    "email": "[email protected]",
    "password": "123456"
}

Description of Response data

Fields Description TYPE
id id of logged in the user. String
email Email of logged in the user. String
userIp ip Address of logged in user. String
token Authentication token of logged in user String

Example of API Response:

On Successful Login

{
    "statusCode": 7000,
    "message": "Login is successful",
    "data": {
        "user": {
            "id": "5fef460f026ca8254c5f998d",
            "email": "[email protected]",
            "userIp": "::1"
        },
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmZWY0NjBmMDI2Y2E4MjU0YzVmOTk4ZCIsImlhdCI6MTYwOTUxNzc2MCwiZXhwIjoxNjA5NTE5NTYwfQ.w0KURaS-XAJI6PLeS3UaVf_kWkardAuyFPKwMiNpn7k"
    }
}

For Logout

Make POST Request for logout on End Point - https://blog-api-tanixq.herokuapp.com/api/users/logout

Provide Authorization Token in header.

For Creating Blog

Make POST Request for Creating Blog on End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/create-new

Provide Authentication Token in Header

Generate Token by Login and Copy it.

Provide Following data in body

Fields Description TYPE Required
title Title of the blog. String required
content content of the blog. String required
thumbImage image for blog thumb. file required
category category for blog. String required
categories options: ['fashion', 'food', 'travel', 'music', 'lifestyle', 'fitness', 'diy', 'finance', 'technology', 'other'],

For Viewing User Blog

Make Get Request for View User Blogs on End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/view/user-blogs

Provide Authentication Token in Header

Generate Token by Login and Copy it.

For View User Profile Blog

Make Get Request for View User Profile on End Point - https://blog-api-tanixq.herokuapp.com/api/users/profile

Provide Authentication Token in Header

Generate Token by Login and Copy it.

For Viewing Public Blog

Make Get Request for Public Blogs on End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/view/

For Verify User Account

Make POST Request for Verify User Account on End Point - https://blog-api-tanixq.herokuapp.com/api/users/email/verify

Provide Following data in body

Fields Description TYPE Required
email Email of the user. String Yes
otp otp received in email String Yes

Example :-

{  
    "email": "[email protected]",
    "otp": "187849"
}

Example of API Response:

On Successful Login

{
    "statusCode": 7000,
    "message": "Your account verificaiton is successful.",
    "data": ""
}

For Resend otp

Make POST Request for Resend otp on End Point - https://blog-api-tanixq.herokuapp.com/api/users/email/resend

Provide Following data in body

Fields Description TYPE Required
email Email of the user. String Yes

Example :-

{  
    "email": "[email protected]",
}

For Edit User Bio

Make POST Request for Resend otp on End Point - https://blog-api-tanixq.herokuapp.com/api/users/profile/edit/bio

Provide Authentication token in header and Provide Following data in body

Fields Description TYPE Required
bio bio of the user. (max:160) String Yes

Example :-

{  
    "bio": "loremispusm etc etc ...",
}

For Admin Login

Make POST Request for Admin Login on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/login

Provide Following data in body

Fields Description TYPE Required
adminUsername Username of the admin. String Yes
adminPassword Password of the admin. String Yes

For Admin Logout

Make POST Request for logout on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/logout

Provide Admin Authorization Token in header.

For View Pending Blogs

Make GET Request for View Pending Blogs on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/view/pending-blogs

Provide Admin Authentication Token in Header.

Generate Token by Admin Login and Copy it.

For View Rejected Blogs

Make GET Request for View Rejected Blogs on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/view/rejected-blogs

Provide Admin Authentication Token in Header.

Generate Token by Admin Login and Copy it.

For View Approved Blogs

Make GET Request for View Approved Blogs on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/view/approved-blogs

Provide Admin Authentication Token in Header.

Generate Token by Admin Login and Copy it.

For Approve Blog

Make POST Request for Approve Blog on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/blog/approve

Provide Admin Authentication Token in Header. Generate Token by Admin Login and Copy it.

Provide blogId in body.

Example: -

{
    "blogId" : "5fe77e9c6ef2010017df962a"
}

For Reject Blog

Make POST Request for Reject Blog on End Point - https://blog-api-tanixq.herokuapp.com/api/admin/blog/reject

Provide Admin Authentication Token in Header. Generate Token by Admin Login and Copy it.

Provide blogId in body.

Example: -

{
    "blogId" : "5fe77e9c6ef2010017df962a"
}

For Password Reset

Make POST Request for Password Reset on End Point - https://blog-api-tanixq.herokuapp.com/api/users/password/reset

Provide Following data in body

Fields Description TYPE Required
email Email of the user. String Yes
otp otp generated from resend route. String Yes
newPassword new password of the user. String Yes

Example :-

{  
    "email": "[email protected]",
    "otp": "122458",
    "newPassword": "12354567890",
}

For View Blog by Category

Make GET Request for View by Category on End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/view/category/:categoryName

replace categoryName with one of these ['fashion', 'food', 'travel', 'music', 'lifestyle', 'fitness', 'diy', 'finance', 'technology', 'other']

For View Blog by Title

Make GET Request for View by Category on End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/view/:blogTitle

replace blogTitle with title of the blog.

For Delete Blog

Make DELETE request For Delete Blog End Point - https://blog-api-tanixq.herokuapp.com/api/blogs/delete/by-id

Provide Authentication Token in Header. Generate Token by Admin Login and Copy it.

Provide blogId in body.

Example: -

{
    "blogId" : "5fe77e9c6ef2010017df962a"
}

blog-api's People

Contributors

tanixq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.