Skip to content

Latest commit

 

History

History
383 lines (342 loc) · 10.1 KB

README.md

File metadata and controls

383 lines (342 loc) · 10.1 KB

heartarcade

A website developed with Django framework which offers the member to write quotes. They can tag their quotes to various categories. Anyone can sign in using their email address or facebook or twitter.Complete Rest Api is integrated

Endpoints

  1. User registration and login

  2. Quotes

  3. User Profile

Sample API Request & Response

POST api/account/signup/

  • Details:This API end point is for creating a new user.

Request body:

{
    "username": "NeilArmstrong",
    "email": "neil123@gmail.com",
    "password":"********",
    "password2":"********"
}

Response body:

{
    "response": "succesfully registered a new user",
    "email": "neil123@gmail.com",
    "username": "NeilArmstrong",
    "token": "ea1aeef0258fe48921a522f08fefd6c12d99b7bc"
}

POST api/account/login/

  • Details:This API end point is for signing in the users.

Request body:

{
    "username": "NeilArmstrong",
    "password":"********"
}

Response body:

{
    "token": "ea1beef0258ye48921a622f08fefd7c18d99b7bc"
}

GET /api/quote/

  • Details:This API end point is for Getting all the quotes.

Response body:

{
    "count": 12,
    "next": "http://heartarcade.herokuapp.com/api/quote/?page=2",
    "previous": null,
    "results": [
        {
            "quote": "Callousness and insolence bring to bare unanimous social condemnation, while the simple efforts of politeness are admired; even in those who are otherwise despised.",
            "author": "shifat123",
            "categories": [
                "positive",
                "respect"
            ],
            "pub_date": "02/16/20",
            "slugged_username": "shifat123"
        },
        {
            "quote": "Work is love made visible. And if you cannot work with love but only with distaste, it is better that you should leave your work and sit at the gate of the temple and take alms of those who work with joy.",
            "author": "shifat123",
            "categories": [
                "love",
                "work"
            ],
            "pub_date": "02/16/20",
            "slugged_username": "shifat123"
        },
        {
            "quote": "Knowledge of the self is the mother of all knowledge. So it is incumbent on me to know my self, to know it completely, to know its minutiae, its characteristics, its subtleties, and its very atoms.",
            "author": "shifat123",
            "categories": [
                "courage",
                "dream",
                "education"
            ],
            "pub_date": "02/16/20",
            "slugged_username": "shifat123"
        },
    ]
}

GET api/quote/category/

  • Details:This API end point is for getting all the quote categories. Token Authentication required.

Response body:

{
    "count": 63,
    "next": "http://heartarcade.herokuapp.com/api/quote/category/?page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "title": "alone"
        },
        {
            "id": 2,
            "title": "art"
        },
        {
            "id": 3,
            "title": "attitude"
        },
        {
            "id": 4,
            "title": "beauty"
        },
        {
            "id": 5,
            "title": "change"
        },
        {
            "id": 6,
            "title": "cool"
        },
        {
            "id": 7,
            "title": "courage"
        },
        {
            "id": 8,
            "title": "dream"
        },
        {
            "id": 9,
            "title": "education"
        },
        {
            "id": 10,
            "title": "environment"
        }
    ]
}

GET api/quote/category/:category/

  • Details:This API end point is for getting all the quote under a specific category. Token Authentication required.

Response body:

[
    {
        "quote": "Pain and foolishness lead to great bliss and complete knowledge, for Eternal Wisdom created nothing under the sun in vain.",
        "author": "shifat123",
        "categories": [
            "inspirational",
            "motivational"
        ],
        "pub_date": "02/16/20",
        "slugged_username": "shifat123"
    },
    {
        "quote": "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.",
        "author": "MdLutforRahman",
        "categories": [
            "hope",
            "imagination",
            "inspirational"
        ],
        "pub_date": "02/17/20",
        "slugged_username": "mdlutforrahman"
    }
]

POST api/quote/create/

  • Details:This API end point is for creating a new quote. Token Authentication required.

Request body:

{
    "quote": "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking.",
    "categories": [
        1,
        2
    ]
}

Response body:

{
    "quote": "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking.",
    "author": "2976383e-d781-4957-a5c1-bec1ec8067b2",
    "categories": [
        1,
        2
    ]
}

GET api/quote/:quote_id/

  • Details:This API end point is for getting the details of a specific quote. Token Authentication required.

Response body:

{
    "quote": "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking.",
    "categories": [
        1,
        2
    ]
}

POST api/quote/:id/edit/

  • Details:This API end point is for updating a specific quote. Token Authentication required.

Request body:

{
    "quote": "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking.",
    "categories": [
        1,
        2,
        4
    ]
}

Response body:

{
    "success": "update successful"
}

DELETE api/quote/:id/delete/

  • Details:This API end point is for deleting a specific quote. Token Authentication required.

Response body:

{
    "success": "Delete successful"
}

GET api/profile/:slug_username/

  • Details:This API end point is for getting all the quotes published by a specific user. Token Authentication required.

Response body:

[
    {
        "quote": "Callousness and insolence bring to bare unanimous social condemnation, while the simple efforts of politeness are admired; even in those who are otherwise despised.",
        "author": "shifat123",
        "categories": [
            "positive",
            "respect"
        ],
        "pub_date": "02/16/20"
    },
    {
        "quote": "Work is love made visible. And if you cannot work with love but only with distaste, it is better that you should leave your work and sit at the gate of the temple and take alms of those who work with joy.",
        "author": "shifat123",
        "categories": [
            "love",
            "work"
        ],
        "pub_date": "02/16/20"
    },
    {
        "quote": "Knowledge of the self is the mother of all knowledge. So it is incumbent on me to know my self, to know it completely, to know its minutiae, its characteristics, its subtleties, and its very atoms.",
        "author": "shifat123",
        "categories": [
            "courage",
            "dream",
            "education"
        ],
        "pub_date": "02/16/20"
    },
    {
        "quote": "Nor shall derision prove powerful against those who listen to humanity or those who follow in the footsteps of divinity, for they shall live forever. Forever.",
        "author": "shifat123",
        "categories": [
            "humor",
            "intelligence"
        ],
        "pub_date": "02/16/20"
    },
    {
        "quote": "Pain and foolishness lead to great bliss and complete knowledge, for Eternal Wisdom created nothing under the sun in vain.",
        "author": "shifat123",
        "categories": [
            "inspirational",
            "motivational"
        ],
        "pub_date": "02/16/20"
    }
]

GET api/profile/

  • Details:This API end point is for getting the details of the users. Token Authentication required.

Response body:

{
    "username": "NeilArmstrong",
    "email": "neil123@gmail.com"
}

GET api/profile/change-username

  • Details:This API end point is for getting the username of the users. Token Authentication required.

Response body:

{
    "username": "NeilArmstrong"
}

PUT api/profile/change-username

  • Details:This API end point is for updating the username of the users. Token Authentication required.

Request body:

{
    "username": "Neil_Armstrong"
}

Response body:

{
    "response": "Username update successful"
}

PUT api/profile/change-password/

  • Details:This API end point is for updating the password of the users. Token Authentication required.

Request body:

{
    "old_password":  "*********"
    ,
    "password":  "************"
    ,
    "confirm_password": "************"
}

Response body:

{
    "Success": "Password has been updated successfully"
}