---
# System prepended metadata

title: Online Coaching

---

# Online Coaching
## Get Categories
``` json

# GET {url}/api/cms/v1/categories

# body 

# response 
"message": "success",
"data": [
    {
        "id": 1,
        "name": "Sagar"
    },
    {
        "id": 2,
        "name": "Sagar"
    },
    {
        "id": 3,
        "name": "Sagar"
    }
]
````

## Create course
``` json

# POST {url}/api/cms/v1/course

# body 

{
    "product_id": 1, // required
    "category_id": 2, // required
    "name": "Sagar", // required
    "thumbnail": "",
    "in_stock": 0,
    "video_url": "youtube_id" // required
}

# response 
"message": "success",
"data": {
    "id": 1,
    "product_id": 1,
    "category_id": 2,
    "name": "Sagar",
    "thumbnail": "",
    "in_stock": 0,
    "video_url": "youtube_id"
}

```

## PUT course
``` json

# PUT {url}/api/cms/v1/course/:id

# body 

{
    "product_id": 1, // required
    "order_idx": 1, 
    "category_id": 2, // required
    "name": "Sagar", // required
    "description": "Sagar",
    "thumbnail": "",
    "in_stock": 0,
    "video_url": "youtube_id" // required
}

# response 
"message": "success",
"data": {
    "product_id": 1, 
    "order_idx": 1, 
    "category_id": 2, 
    "name": "Sagar", 
    "description": "Sagar",
    "thumbnail": "",
    "in_stock": 0,
    "video_url": "youtube_id" 
}

```
## GET course
``` json

# GET {url}/api/cms/v1/course

# body 

# response 

"data": [
    {
        "course_id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    },
    {
        "course_id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    },
    {
        "course_id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    }
]
```

## DELETE course
``` json

# DELETE {url}/api/cms/v1/course/:id

# response 
{
    "message": "success",
    "data": []
}

```
## Create resource
``` json

# POST {url}/api/cms/v1/resources

# body 

{
    "course_id": 1, //Required
    "name": "resource_name", //Required
    "icon": "icon.jpg", //Required
    "description": "description", //Required
    "file_type": "pdf", //Required
    "file_url": "facebook.com" //Required
}

# response 
"message": "success",
"data": {
    "id", 1,
    "course_id": 1, 
    "name": "resource_name", 
    "icon": "icon.jpg", 
    "description": "description", 
    "file_type": "pdf", 
    "file_url": "facebook.com",
    "created_at": "2021-12-05 17:01:46",
    "updated_at": "2021-12-05 17:01:46"
}

```

## PUT resource
``` json

# PUT {url}/api/cms/v1/resources/:id

# body 

{
    "course_id": 1
    "name": "samantha",
    "icon": "image.jpg",
    "description": "description",
    "file_type": "pdf",
    "file_url": "youotube.com"
}

# response 
"message": "success",
"data": {
    "id", 1,
    "course_id": 1, 
    "name": "resource_name", 
    "icon": "icon.jpg", 
    "description": "description", 
    "file_type": "pdf", 
    "file_url": "facebook.com",
    "created_at": "2021-12-05 17:01:46",
    "updated_at": "2021-12-05 17:01:46"
}

```
## GET resources
``` json

# GET {url}/api/cms/v1/resources

# body 

# response 

"data": [
    {
        "id", 1,
        "course_id": 1, 
        "course": {
            "id": 1,
            "name": "Arts And Crafts"
        },
        "name": "resource_name", 
        "icon": "icon.jpg", 
        "description": "description", 
        "file_type": "pdf", 
        "file_url": "facebook.com",
        "created_at": "2021-12-05 17:01:46",
        "updated_at": "2021-12-05 17:01:46"
    },
    {
        "id", 2,
        "course_id": 2, 
        "course": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "name": "resource_name", 
        "icon": "icon.jpg", 
        "description": "description", 
        "file_type": "pdf", 
        "file_url": "facebook.com",
        "created_at": "2021-12-05 17:01:46",
        "updated_at": "2021-12-05 17:01:46"
    },
    {
        "id", 3,
        "course_id": 1, 
        "course": {
            "id": 1,
            "name": "Arts And Crafts"
        },
        "name": "resource_name", 
        "icon": "icon.jpg", 
        "description": "description", 
        "file_type": "pdf", 
        "file_url": "facebook.com",
        "created_at": "2021-12-05 17:01:46",
        "updated_at": "2021-12-05 17:01:46"
    }
]
```

## DELETE resource
``` json

# DELETE {url}/api/cms/v1/resources/:id

# body 

{
}

# response 

{
    "status": "Accepted",
    "message": "success",
    "data": []
}
````
## Get Course Steps
``` json

# GET {url}/api/cms/v1/categories/:id/steps

# body 

# response 
"message": "success",
"data": [
"data": [
    {
        "id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    },
    {
        "id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    },
    {
        "id": 1,
        "product_id": 1,
        "category_id": 2,
        "order_idx": 1, 
        "category": {
            "id": 2,
            "name": "Arts And Crafts"
        },
        "description": "Sagar",
        "name": "Sagar",
        "thumbnail": "",
        "in_stock": 0,
        "video_url": "youtube_id"
    }
]
````

## Create Course Step
``` json

# POST {url}/api/cms/v1/course/:id/steps

# body 
    
{
	"contents": [
		{
			"content_type": "class", // class or resource  // Required
            "month_id": 1, // Required
			"content_id": 1, // Required
            "order_idx": 1,
			"is_preview": 1,
			"pass_percent": 80
		}
	]
}


# response 

{
  "data": [
    {
      "id": 65,
      "course_id": 1,
      "content_type": "chapter",
      "month_id": 1,
      "content_id": 1,
      "order_idx": 0,
      "is_preview": 1,
      "pass_percent": 80
    }
  ]
}

````
## Delete Course Step
``` json

# POST {url}/api/cms/v1/course/:id/deleteSteps

# body 

{
    ids: [1,2,3]
}

# response 

{
    "status": "Accepted",
    "message": "success",
    "data": []
}
````
