pipalacademy / riyaz

A light-weight, self-hostable learning platform.
MIT License
2 stars 0 forks source link

Course development API #7

Open nikochiko opened 2 years ago

nikochiko commented 2 years ago

Part of #4

REST API

Resources: courses, assets, lessons, authors

Base prefix: /api

Endpoints:

  1. /courses Methods:
    • GET - Get all courses
    • POST - Create a new course
  2. /courses/:course_name Methods:
    • GET - Get a course by its name (like joy-of-programming)
    • PUT - Update course details
    • DELETE - Delete a course
  3. /courses/:course_name/assets Methods:
    • GET - Get list of assets in a course
    • POST / PUT - Add a new asset
  4. /courses/:course_name/lessons Methods:
    • GET - Get list of lessons in a course
    • POST / PUT - Add a new lesson
  5. /courses/:course_name/authors Methods:
    • GET - Get list of authors in a course
    • POST / PUT - Add a new author
  6. /assets/:course_name/:path_to_asset Methods:
    • GET - Get asset at the specified path
    • PUT - Update asset at the specified path
    • DELETE - Delete the asset
  7. /lessons/:course_name/:path_to_lesson :path_to_lesson can have at most 1 level of hierarchy. Either, :path_to_lesson = lesson-name or module-name/lesson-name Methods:
    • GET - Get lesson at the specified path
    • PUT - Update lesson at the specified path
    • DELETE - Delete lesson at the specified path
  8. /author/:course_name/:author_name xor /author/:author_name Methods:
    • GET - Get lesson at the specified path
    • PUT - Update lesson at the specified path
    • DELETE - Delete lesson at the specified path

The problem with this is that we don't have endpoints that will take static IDs. Paths may change with a PUT request. A few solutions could be:

@anandology what do you think?