Skip to content

[Spec API] HomePage

Nguyen Bui Thien Dat edited this page Aug 1, 2023 · 9 revisions

HomePage API

Search My Courses

Summary :

This API will select the top 10 most registered courses

Endpoint :

  • GET: /api/courses/top-10

Request body :

  • None

Response :

  • Success:
    {

        "success" : true,

        "message": String,

        "status_code": number

        "data":[

                    {

                        "thumbnail": string,

                        "author": {

                                 "first_name":string,

                                 "last_name":string,

                                 "id":number

                        }

                        "ratings": number,

                        "categories":[

                                        {

                                            "id": number,

                                            "title": string,

                                        }

                                   ],

                        "title": string,

                        "id": number,
                        
                        "slug": string

                    }

              ]

    }
  • Failure:
    {

        "success": false,

        "message": string,

        "status_code": number

    }

Status code :

  • 200: If the request is successful
  • 400: If the request is failed
  • 500: If the server is down

Get all categories

Summary :

This API will select all the categories

Endpoint :

  • GET: /api/categories/

Request body :

  • None

Response :

  • Success:
    {

        "success" : true,

        "message": string,

        "status_code": number

        "data":[

                    {

                        "title": string,

                        "id": number

                    }

              ]

    }
  • Failure:
    {

        "success": false,

        "message": string,

        "status_code": number

    }

Status code :

Status code Message Description
200 Get data successfully Get top 10 courses data successfully, return data
400 Validation failed Request body field missing
500 Server down Server is down