User Profile API - masai-oss/Masai_Refresh GitHub Wiki

Get all bookmarks

GET/api/user_profile/all_bookmarks

PARAMS

  • Header: Bearer <Token>

RESPONSE

Success

  • If the user has no bookmarks (Status code: 200)
{
    "error": false,
    "data": null
}
  • If the user has bookmarks (Status code: 200)
{
    "error": false,
    "data": [
        {
            "_id": "60bc997c946b8458d607d9d2",
            "name": "JAVASCRIPT",
            "icon": "2021-04-02T09:36:50.961Zjavascript.svg",
            "total_bookmarks": 1
        },
        {
            "_id": "60bc99c02fa23a596f1d69d1",
            "name": "REACT",
            "icon": "2021-04-02T08:01:56.310Zreact.svg",
            "total_bookmarks": 2
        }
    ]
}

Failure (Status Code: 500)

{
   "error" : true,
   "message" : "Something went wrong",
   "reason" : err
}

Get bookmark details for a topic

POST/api/user_profile/topicwise_bookmarks

PARAMS

  • Header: Bearer <Token>
  • Body:
{
    "topic_id" : "60bc997c946b8458d607d9d2"
}

RESPONSE

Success

  • if the user has no bookmarks on that topic (Status code: 200)
{
    "error": false,
    "data": null
}
  • if the user has bookmarks on that topic (Status code: 200)
{
    "error": false,
    "data": {
        "topic_id": "60bc99c02fa23a596f1d69d1",
        "name": "REACT",
        "icon": "2021-04-02T08:01:56.310Zreact.svg",
        "total_bookmarks": 2,
        "bookmark_details": [
            {
                "statement": "Do I need to keep all my state into Redux? Should I ever use react internal state?",
                "question_id": "60bc99c02fa23a596f1d6aaa"
            },
            {
                "statement": "What are the benefits of using typescript with reactjs?",
                "question_id": "60bc99c02fa23a596f1d6b13"
            }
        ]
    }
}

Failure

  • If topic id not sent (Status code: 400)
{
    "error": true,
    "message": "Send a topic id"
}
  • If topic id is not a valid mongo id (Status code: 400)
{
    "error": true,
    "message": "Invalid topic id"
}
  • Others (Status code: 500)
{
   "error" : true,
   "message" : "Something went wrong",
   "reason" : err
}
⚠️ **GitHub.com Fallback** ⚠️