Users - API Documentation

Be a part of the massive food community !

Sign in

Signs in a user with a valid username and password.

POST
/signin

Parameters
username String Username of the user logging in.
password String Password of the user loggin in.
Response
{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNThjZDc2ZjY4M2JlZTA0ZTlmYWVlMmFkIiwidXNlcm5hbWUiOiJhbmFzIiwiZmlyc3RfbmFtZSI6ImFuYXMiLCJpYXQiOjE0OTAxNjUzNzUsImV4cCI6MTQ5MDc3MDE3NX0.gH_DL6QRl4-9ktGfLUn7fSYbqwGqlxO0cRZ1X1bsjJ4"
}

Sign out

Signs out current signed in user.

GET
/signout

Parameters
access_token String A valid access token.
Response
Status: 200

Add user

Create a user with the given data.

POST
/users

Parameters
Key Type Description
username String Username for the user.
password String Password for the account. Mininum 9 characters.
email String Email address of the user.
first_name String User's firstname.
last_name String User's lastname.
gender String Gender of the user.
date_of_birth String User's date of birth.
phone String User's phone number.
address
{
    alias: String,
    addressLine1: String,
    addressLine2: String,
    landmark: String,
    city: String,
    district: String,
    country: String,
    zip: String,
    loc: String{
        longitude: Number,
        latitude: Number
    }
}
Response
Status: 201

Search users

Search for users matching given query parameters.

GET
/users

Parameters
access_token String A valid access token.
query String Part of username or first_name of the user.
Response
[
    {
        "id": "58cb721293afc42be47bf6ca",
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "avatar": "58cb721293afc42be47bf6ca-user-avatar.jpg",
        "rating": 4
    }
]

Get my profile

GET
/me

Parameters
access_token String A valid access token.
Response
{
    "id": "58cb721293afc42be47bf6ca",
    "first_name": "John",
    "last_name": "Doe",
    "username": "johndoe",
    "avatar": "58cb721293afc42be47bf6ca-user-avatar.jpg",
    "gender": "String",
    "date_of_birth": "2014-02-10T10:50:42.389Z",
    "badges": [
        {
            "badge_id": "34cb721293afc42be47bf6df",
            "badge_title": "Captain Chef",
            "badge_cover": "67cb721293afc42be47bf6ef-badge-cover.jpg",
            "recieved": "2014-02-10T10:50:42.389Z"
        }
    ],
    "email": "johndoe@gmail.com",
    "phone": "9713173946",
    "address": [
        {
            "id": "98cb721293afc42be47bf6df",
            "alias": "Home",
            "addressLine1": "Harry Street",
            "addressLine2": "Anugraha (H)",
            "landmark": "ISRO",
            "state": "Karnataka",
            "city": "Hebbal",
            "district": "Bangalore",
            "country": "India",
            "geo": {
                "latitude": "40.044",
                "longitude": "20.678"
            }
        }
    ],
    "following": 54,
    "followers": 32,
    "favourites": [
        {
            "recipe_id": "34j9jsidjr75650sksdjsdjs",
            "recipe_title": "Kerala Putt",
            "recipe_cover": "34j9jsidjr75650sksdjsdjs-recipe-cover",
            "recipe_rating": 4
        }
    ],
    "shopping_list": [
        {
            "id": "34j9jsidjr75650sksdjsdjs",
            "item_id": "34j9jsidjr75650123dfsdjs",
            "item_title": "Red Onion",
            "item_quantity": 1,
            "item_unit": "kilogram"
        }
    ],
    "preferences": [
        {
            "property_key": "is_vegetarian",
            "propert_value": "true"
        }
    ]
}

Get a single user

GET
/user/:user_id/

Parameters
access_token String A valid access token.
Response
{
    "id": "58cb721293afc42be47bf6ca",
    "first_name": "John",
    "last_name": "Doe",
    "username": "johndoe",
    "avatar": "58cb721293afc42be47bf6ca-user-avatar.jpg",
    "gender": "String",
    "badges": [
        {
            "badge_id": "34cb721293afc42be47bf6df",
            "badge_title": "Captain Chef",
            "badge_cover": "67cb721293afc42be47bf6ef-badge-cover.jpg",
            "recieved": "2014-02-10T10:50:42.389Z"
        }
    ],
    "email": "johndoe@gmail.com",
    "phone": "9713173946"
}

Get my shopping list

Get shopping list details of current logged in user.

GET
/me/shopping-list

Parameters
access_token String A valid access token.
Response
[
    {
        "item": {
            "_id": "58cb721293afc42be47bf6ca",
            "title": "Mango"
        },
        "item_unit": "kilo",
        "item_quantity": 5,
        "_id": "58d50c013308ef24f2db5cca"
    }
]

Follow user

Follows a user.

PUT
/users/:user_id/follow

Parameters
access_token String A valid access token.
Response
Status: 204

Unfollow user

Removes a users from the follow list.

DELETE
/users/:user_id/unfollow

Parameters
access_token String A valid access token.
Response
Status: 204

Get my followers

Gets the list of followers of specified user.

GET
/users/:user_id/followers

Parameters
access_token String A valid access token.
Response
[
    {
        "user_id": "",
        "user_username": "albinpeter",
        "user_first_name": "Albin",
        "user_rating": 4
    }
]

Get my following

Gets the list of following of specified user.

GET
/users/:user_id/following

Parameters
access_token String A valid access token.
Response
[
    {
        "user_id": "",
        "user_username": "albinpeter",
        "user_first_name": "Albin",
        "user_rating": 4
    }
]

Get user followers

Gets the list of followers of specified user.

GET
/users/:user_id/followers

Parameters
access_token String A valid access token.
Response
[
    {
        "user_id": "",
        "user_username": "albinpeter",
        "user_first_name": "Albin",
        "user_rating": 4
    }
]

Get user following

Gets the list of following of specified user.

GET
/users/:user_id/following

Parameters
access_token String A valid access token.
Response
[
    {
        "user_id": "",
        "user_username": "albinpeter",
        "user_first_name": "Albin",
        "user_rating": 4
    }
]

Edit user

Edits user with the given data.

PATCH
/users

Parameters
access_token String A valid access token.
first_nameStringFirst name of the user.
last_nameStringLast name of the user.
avatarimageProfile avatar of the user.
passwordStringLogin Password of the user.
genderStringGender of the user.
date_of_birthDateDate of birth of the user.
contact{ }Contact details.
address{ }Address details.
preferences[{ }]Preferences.
Response
Status: 201

Report User

Reports a user.

PUT
/users/:user_id

Parameters
access_token String A valid access token.
reason_type String Type of the report reason.
reason_type String Body of the report reason.
Response
Status: 200

Delete user

DELETE
/user/:user_id

Parameters
access_token String A valid access token.
Response
Status: 204