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 |
or
|
or
|
| ||||||||
enbaleGroups | 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) |
|
|
| ||||||||
privileges |
| ||||||||||
copytoChildren | true/false |
| |||||||||
copyFromCategory | {category_id} |
| |||||||||
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 |
|
| 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 |
|
| It will be used to define certain set of privileges so that it can be used for the categories. this is optional. | ||||||||
users |
|
| the set of users, the privilges gonaa be set for. |
...
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"] } }' |
Form API config for generalization API
Group for course/batch/groups etc:
Code Block |
---|
groups: [
{
"name": "Group_name", // Group for all creators
"sbIds": [$userIdentifier],
"privileges": [group:topic:create, group:topic:reply]
}
] |
We are calling this api when the new course created from UI (can be sunbird/IGOT).
the payload looks like
Form Read
Code Block |
---|
{
"id": "api.form.read",
"params": {
"resmsgid": "cbdc71cb-8c0f-4714-b164-1ee2c4f98125",
"msgid": "74b0c5df-720d-4777-8d12-123d0c094ce1",
"status": "successful"
},
"responseCode": "OK",
"result": {
"form": {
"type": "global",
"subtype": "forum",
"action": "creation",
"component": "*",
"framework": "*",
"data": {
"templateName": "defaultTemplate",
"action": "creation",
"fields": [
{
"index": 0,
"type": "Course",
"title": "Course",
"primaryCategoryId": "2 ",
"groups": [
{
"name": "Course_Owner",
"permissions": [
"read",
"vote",
"post",
"moderate",
"topic"
],
"SbIds": ["$Sunbird_identifier"] // can be changed
}
],
"subCategoris": [
]
}
]
},
"created_on": "2021-02-04T09:27:01.635Z",
"last_modified_on": "2021-02-04T10:08:29.445Z",
"rootOrgId": "*"
}
},
"ts": "2021-03-16T15:20:46.990Z",
"ver": "1.0"
} |
Request Payload
Code Block |
---|
{
"category": {
"name": "Course Name",
"pid": "120", // categoryId which holds all course categories
"description": "Creators can start discussions", // can be change
"context": [
{
"type": "course",
"identifier": "course_013178064710950002"
}
],
"groups": [
{
"name": "Creator_Group", // group name
"privileges": [ // what are the privileges that creator role has
"groups:topics:reply",
"groups:topics:create"
],
"sbUids": [ // subbird identifiers
"8454cb21-3ce9-4e30-85b5-fade097880d8"
]
}
]
}
} |
Batch
Code Block |
---|
groups: [
{
"name": "Group_name", // Group for all mentor
"sbIds": [$userIdentifier],
"privileges": [group:topic:create, group:topic:reply]
}
] |
We are calling this api when the new batch created from UI (can be sunbird/IGOT).
Note: sbIds batch mentors id's and this id's added into mentors groups
the payload looks like
Code Block |
---|
{
"id": "api.form.read",
"params": {
"resmsgid": "cbdc71cb-8c0f-4714-b164-1ee2c4f98125",
"msgid": "74b0c5df-720d-4777-8d12-123d0c094ce1",
"status": "successful"
},
"responseCode": "OK",
"result": {
"form": {
"type": "global",
"subtype": "forum",
"action": "creation",
"component": "*",
"framework": "*",
"data": {
"templateName": "defaultTemplate",
"action": "creation",
"fields": [
{
"index": 0,
"type": "Course",
"title": "Course",
"primaryCategoryId": "2 ",
"groups": [
{
"name": "Course_Owner",
"permissions": [
"read",
"vote",
"post",
"moderate",
"topic"
],
"SbIds": ["$Sunbird_identifier"] // can be changed
}
],
"subCategories": [
{
"name": "Announcements",
"groups": [
{
"name": "Group_name",
"sbIds": ["$userIdentifier"],
"privileges": ["group:topic:create", "group:topic:reply"]
}
],
"privileges": {
"copyFromParent": "true/false"
}
},
{
"name": "General Discussions",
"groups": [
{
"name": "Group_name",
"sbIds": ["$userIdentifier"],
"privileges": ["group:topic:create", "group:topic:reply"]
}
],
"privileges": {
"copyFromParent": "true/false"
}
}
]
}
]
},
"created_on": "2021-02-04T09:27:01.635Z",
"last_modified_on": "2021-02-04T10:08:29.445Z",
"rootOrgId": "*"
}
},
"ts": "2021-03-16T15:20:46.990Z",
"ver": "1.0"
} |
Request payload
Code Block |
---|
{
"category": {
"name": "Batch Name",
"pid": "120", // categoryId which holds all course categories
"description": "Creators can start discussions", // can be change
"context": [
{
"type": "batch",
"identifier": "batch_013178064710950002"
}
],
"groups": [
{
"name": "Creator_Group", // group name
"privileges": [ // what are the privileges that creator role has
"groups:topics:reply",
"groups:topics:create"
],
"sbUids": [ // subbird identifiers
"8454cb21-3ce9-4e30-85b5-fade097880d8"
]
}
],
"subCategories": [
{
"name": "Announcements",
"groups": [
{
"name": "Group_name",
"sbIds": ["$userIdentifier"],
"privileges": ["group:topic:create", "group:topic:reply"]
}
],
"privileges": {
"copyFromParent": "true/false"
}
},
{
"name": "General Discussions",
"groups": [
{
"name": "Group_name",
"sbIds": ["$userIdentifier"],
"privileges": ["group:topic:create", "group:topic:reply"]
}
],
"privileges": {
"copyFromParent": "true/false"
}
}
]
}
} |
Groups
Code Block |
---|
{
"category": {
"name": "Group Name",
"pid": "120", // categoryId which holds all course categories
"description": "Creators can start discussions", // can be change
"context": [
{
"type": "group",
"identifier": "group_013178064710950002"
}
]
}
} |
Comments
MOM: Generalization of API
...