Course

These instructions will explain you about how to work with courses upload and getting API.

Course model fields

Course model in database contains next fields:

  • Required:

    • id (uuid)

    • title (CharField)

    • description (TextField)

    • external_link (URLField)

    • is_featured (BooleanField)

  • Optional:

    • program_title (CharField)

    • image_url (URLField)

    • provider (ForeignKey to Provider, setting to Null, if Provider was deleted)

    • tutor (CharField)

    • industries (ManyToManyField)

    • skills (ManyToManyField)

    • duration (PositiveSmallIntegerField)

Course View Set

Create new course

Method create(self, request) acccepting POST requests with JSON information about new course.

Returns

  • If ok:

    • Code status 200

    • pk JSON with Course id on bdn

  • Else:

    • Code status 400

    • error JSON with errors

Example:

Get course info

Method retrieve(self, request, pk=None) acccepting GET requests with course id and reply with JSON information about course and provider academy profile.

Returns

  • If ok:

    • Code status 200

    • JSON with Course data and Academy data

Example

Get courses list

Method list(self, request) acccepting GET requests reply with JSON information about courses.

Returns

  • If ok:

    • Code status 200

    • JSON with Courses list data

Example

Get course by id

Method get_by_id(self, request, pk=None) acccepting GET requests with course id and reply with JSON information about course.

Returns

  • If ok:

    • Code status 200

    • JSON with Course data

Example

Get courses by provider

Method get_by_provider(self, request) acccepting GET requests with inline eth_address and reply with JSON information about courses by this provider.

Returns

  • If ok:

    • Code status 200

    • JSON with Courses data

Example

Edit course by id

Method edit_by_id(self, request, pk=None) acccepting POST requests with new JSON information about course and inline id.

Returns

  • If ok:

    • Code status 200

-Else if user is not creator of this course:

  • Code status 401

  • Else:

    • Code status 400

    • error JSON with errors

Example:

Method mark_featured_by_id(self, request, pk=None) acccepting POST requests with inline id.

Returns

  • If ok:

    • Code status 200

-Else if user is not creator of this course:

  • Code status 401

Example:

Delete course by id

Method delete_by_id(self, request, pk=None) acccepting POST requests with inline id.

Returns

  • If ok:

    • Code status 200

-Else if user is not creator of this course:

  • Code status 401

Example:

Last updated

Was this helpful?