Skip to content

CategoryView

Verplant edited this page Sep 28, 2017 · 3 revisions

Introduction

The CategoryView class is used to get, create, update and delete course categories. A course category has the fields: 'name' and 'color'

Method Details

'get'

Returns an array of JSON formatted course categories containing every existing category.

Response:

[
    {
        "name": (String) displayname,
        "color": (String) #000000 - #FFFFFF,
        "id": Prima
    },
    ...
]

'post'

Creates a new category with the given attributes or updates an existing if the 'id' field is specified. If 'delete' is sent along with the 'id' field and set to 'true', the specified category, and all its depending courses are deleted.

Request:

{
    'id': id of the categorie to save/delete - do not sent if you desire to create a new category
    'name': (new) name of the new/existing category
    'color': (new) color of the new/existing category
    'delete': 'true'
}

Response: {'ans': 'a category with the given id does not exist'}, (404) , (204_No_Content) {'name':..., 'color':...,'id':...}, (200) serializer errors, (404)

Clone this wiki locally