Skip to content

Latest commit

 

History

History
187 lines (128 loc) · 1.95 KB

courses.md

File metadata and controls

187 lines (128 loc) · 1.95 KB

Courses


Note: for creating, updating and deleting courses user must have admin permissions.

Creating a new course in specific program

api.ayat.com/v1/programs/{id}/courses POST

Payload:
{
  "jwt": "ffff",
  "course_name": "Title",
  "course_description": "description",
  "course_order": "order"
  // other course data.
}
Success Response:
code: 201
{
  "status": "created"
}

or

{
    "status":  "<Duplicate resource codes: 4>"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Updating course's data

api.ayat.com/v1/programs/{id}/courses/{id} PUT

Payload:
{
  "jwt": "ffff"
  // which data to be updated
}
Success Response:
code: 200
{
  "status": "updated"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Retrieving program's courses

api.ayat.com/v1/programs/{id}/courses GET

Payload:
{
  "jwt": "32132143432432"
}
Success Response:
code: 200
{
  "courses": [...]
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Retrieving a specific course's data

api.ayat.com/v1/programs/{id}/courses/{id} GET

Payload:
{
  "jwt": "32132143432432"
}
Success Response:
code: 200
{
  //course data.
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Deleting a course

api.ayat.com/v1/programs/{id}/courses/{id} DELETE

Payload:
{
  "jwt": "ffff"
}
Success Response:
code: 200
{
    "status":  "deleted"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}