API / Competency_categories

Competencies in Silverbucket's database has to have some category. You can manage competency categories with the endpoint /competency_categories:
https:/<your_silverbucket_url>/customer-api/1.0/competency_categories/

GET

If you call the endpoint with GET method you will get all the competency categories from the database. Example result could look like this:
{
    "next": null,
    "previous": null,
    "current": 1,
    "itemsPerPage": 500,
    "count": 1,
    "lastPage": 1,
    "data": [
        {
            "id": 37,
            "created": "2020-06-09T13:24:15.321601",
            "modified": "2020-06-09T13:24:15.367254",
            "name": "Cooking Skills",
            "lft": 1,
            "rght": 2,
            "tree_id": 11,
            "level": 0,
            "competency_level_group": null,
            "parent": null
        }
    ],
    "excelUrl": "/customer-api/1.0/competency_categories/?competency_category.name__icontains=cooking&excel=true",
    "csvUrl": "/customer-api/1.0/competency_categories/?competency_category.name__icontains=cooking&csv=true"
}

POST

You can add new competency categories with the POST method. Message body should contain the name of the category.
{
    "name": "<string>",
    "parent": <competency_category_id>,
    "competency_level_group": <competency_level_group_id>
}

Parent

If you add parent id then the new category is created as a sub category for the parent category. This data is optional and should left out if you want the new category to be on root level.

Competency_level_group

Competency_level_group is a group of competency levels. Different categories can have different competency levels.

PATCH

You can modify competency categories with the PATCH method. Add the competency category id to modify in the endpoint's URL. Add modified attributes to message body.
https:/<your_silverbucket_url>/customer-api/1.0/competency_categories/<competency_category_id>/
You can modify the same attributes which are available for POSTing.
How did we do with this article?