Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

Property

Sub-property

Values

Description

name

{category name}

name of the category.

pid

{parent category id}

under which parent category, this category should get created.

Context

Code Block
{
  "type": "course",
  "identifier": "$courseId"
}

or

Code Block
{
  "type": "batch",
  "identifier": "$batchId”
}
Code Block
{
  "type": "course",
  "identifier": "do_37819”
}

or

Code Block
{
  "type": "batch",
  "identifier": "0312047"
}

  • type: this is the sbType

  • identifier: this is the sbIdentifier

  • if you want to add different types we have to change the value of types
    ex: “Course”, “Batch”, “Group”, “GroupMember”

enbaleGroups
(to de discussed)

true / false

If set true then, It will be used to create groups to add privileges to a certain set of user (according to our requirement)

groups (optional)

Code Block
{
  "name": "<group name>",
  "privileges": [
    < set of privileges >
  ]
}

Code Block
{
  "name": "category owner",
  "privileges": [
    "groups:topics:reply",
    "groups:topics:create"
  ]
}

  • If this object is exist then create the group else don't create

  • It will be used to define certain set of privileges so that it can be used for the categories.

  • If copyFromCategory is defined, then this is optional. Because all the groups added for copyFromCategory will be adding to this category

privileges

  • To set some rules for the users, if we dont want to create the groups. That

copytoChildren

true/false

  • This is used to copy the groups to all sub-categories

  • The same group will be added to sub-categories with the privileges.

copyFromCategory

{category_id}

  • When we mention this property, groups object will become optional.

  • It will copy all the groups & privileges from the specified category & add it to the new category(with the same group name & privileges)

copytoChildren

true / false

If set, it will take the rules

from the given category.

copyFromCategory

category_id, from where it should take the privileges. groups are optional when category_id mention here. It will copy the group & privileges from category_id

subcategories

categories which is gonna be created under the parent category

name

Example: “Announcement“, “General discussion“

name of the subcategory

pid

parent category id under which the sub-category will be created

description

description of the sub-category

context

Code Block
{
    "type": "batch",
    "identifier": "$batchId"
}
Code Block
{
    "type": "batch",
    "identifier": "0123456"
}

this is to communicate with the mapping table.

privileges

This is to override the privileges given at category level for group or user

copyFromCategory

category_id, from where it should take the privileges.

groups

Code Block
{
  "groups": [
    {
      "name": "<group_name>",
      "privileges": [
        <privileges for the group>
      ]
    }
  ]
}
Code Block
{
  "groups": [
    {
      "name": "enrolled users group",
      "privileges": [
        "groups:topics:reply"
      ]
    }
  ]
}

It will be used to define certain set of privileges so that it can be used for the categories. this is optional.

users

Code Block
"users": [
    {
      "uid": "{nodebb_uid}",
      "privileges": [
        <previleges for given set of users>
      ]
    }
  ]
Code Block
"users": [
    {
      "uid": "test_df_1994",
      "privileges": [
       "groups:topics:reply"
      ]
    }
  ]

the set of users, the privilges gonaa be set for.

...

Headers: You need to pass nodebb master token as a authorization token (it is mandatory).

Body: NO

Getting Nodebb UID's By sending Sunbird Identifiers

As we don’t know nodebb uids and we have only sunbird identifiers.so the below api will give you nodebb uids by sending sunbird identifiers.

Code Block
curl --location --request POST 'http://localhost:4567/api/forum/v2/uids' \
--header 'Authorization: Bearer 550998a7-4036-4482-b152-03ff5dedcde0' \
--header 'Content-Type: application/json' \
--header 'Cookie: express.sid=s%3AafcKVNRDU5uKTnTDVIWvs1zZbtdfRYj9.2gZpGnKf6S8PhOk0GsDauciGdZ%2F%2BxPqNPTSy6wQ6WZU' \
--data-raw '{
    "request": {
        "sbIdentifiers": ["fca2925f-1eee-4654-9177-fece3fd6afc9","8454cb21-3ce9-4e30-85b5-fade097880d8"]
    }
}'