Category APIs
This api allows the user to create a new category in nodebb
- The endpoint for Category is
/v2/categories
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories
POST /api/discussion/v2/categories HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 26
{
"name": "NodeJS Tutorial"
}
{
"code": "code",
"payload": {
"color": "color",
"numRecentReplies": "numRecentReplies",
"icon": "icon",
"link": "link",
"description": "description",
"topic_count": "topic_count",
"imageClass": "imageClass",
"parentCid": 6,
"descriptionParsed": "descriptionParsed",
"bgColor": "bgColor",
"name": "name",
"disabled": "disabled",
"post_count": "post_count",
"isSection": "isSection",
"class": "class",
"slug": "slug",
"cid": 0,
"order": "order"
}
}
This api allows the user to get all details of a category by using categoryId and slug from nodebb.
- The endpoint for Category is
/category/{category_id}/{slug}
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/category/{category_id}/{slug}
GET /api/discussion/category/{category_id}/{slug} HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
"unread-class": "unread-class",
"template": {},
"privileges": {},
"pagination": {},
"color": "color",
"numRecentReplies": 5,
"icon": "icon",
"link": "link",
"_header": {},
"description": "description",
"title": "title",
"widgets": {},
"showSelect": true,
"totalTopicCount": 7,
"parentCid": 2,
"maxTags": 2,
"totalPostCount": 4,
"bgColor": "bgColor",
"descriptionParsed": "descriptionParsed",
"children": [
{},
{}
],
"bodyClass": "bodyClass",
"disabled": 6,
"rssFeedUrl": "rssFeedUrl",
"tagWhitelist": [
"tagWhitelist",
"tagWhitelist"
],
"class": "class",
"slug": "slug",
"order": 5,
"minTags": 3,
"showTopicTools": true,
"topics": [
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
},
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
}
],
"isNotWatched": true,
"reputation:disabled": 2,
"isWatched": true,
"isIgnored": true,
"topic_count": 9,
"url": "url",
"imageClass": "imageClass",
"feeds:disableRSS": 1,
"loggedIn": true,
"name": "name",
"isSection": 1,
"post_count": 7,
"relative_path": "relative_path",
"breadcrumbs": [
{},
{}
],
"cid": 0
}
This api allow the user to get all the details of categories using categoryId from nodebb
- The endpoint for Category is
/category/{cid}
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/category/{cid}
GET /api/discussion/category/{cid} HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
"unread-class": "unread-class",
"template": {},
"privileges": {},
"pagination": {},
"color": "color",
"numRecentReplies": 5,
"icon": "icon",
"link": "link",
"_header": {},
"description": "description",
"title": "title",
"widgets": {},
"showSelect": true,
"totalTopicCount": 7,
"parentCid": 2,
"maxTags": 2,
"totalPostCount": 4,
"bgColor": "bgColor",
"descriptionParsed": "descriptionParsed",
"children": [
{},
{}
],
"bodyClass": "bodyClass",
"disabled": 6,
"rssFeedUrl": "rssFeedUrl",
"tagWhitelist": [
"tagWhitelist",
"tagWhitelist"
],
"class": "class",
"slug": "slug",
"order": 5,
"minTags": 3,
"showTopicTools": true,
"topics": [
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
},
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
}
],
"isNotWatched": true,
"reputation:disabled": 2,
"isWatched": true,
"isIgnored": true,
"topic_count": 9,
"url": "url",
"imageClass": "imageClass",
"feeds:disableRSS": 1,
"loggedIn": true,
"name": "name",
"isSection": 1,
"post_count": 7,
"relative_path": "relative_path",
"breadcrumbs": [
{},
{}
],
"cid": 0
}
This api allow the user to get all the details of categories based on cid mentioned in array from nodebb
- The endpoint for Category is
/category/list
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/category/list
POST /api/discussion/category/list HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 26
{
"request": {
"cids": [
2,
3
]
}
}
[
{
"unread-class": "unread-class",
"template": {},
"privileges": {},
"pagination": {},
"color": "color",
"numRecentReplies": 5,
"icon": "icon",
"link": "link",
"_header": {},
"description": "description",
"title": "title",
"widgets": {},
"showSelect": true,
"totalTopicCount": 7,
"parentCid": 2,
"maxTags": 2,
"totalPostCount": 4,
"bgColor": "bgColor",
"descriptionParsed": "descriptionParsed",
"children": [
{},
{}
],
"bodyClass": "bodyClass",
"disabled": 6,
"rssFeedUrl": "rssFeedUrl",
"tagWhitelist": [
"tagWhitelist",
"tagWhitelist"
],
"class": "class",
"slug": "slug",
"order": 5,
"minTags": 3,
"showTopicTools": true,
"topics": [
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
},
{
"pinned": 6,
"lastposttime": 1,
"upvotes": 8,
"unreplied": true,
"unread": true,
"timestampISO": "timestampISO",
"title": "title",
"teaserPid": {},
"tid": 7,
"uid": 4,
"lastposttimeISO": "lastposttimeISO",
"deleterUid": 6,
"isOwner": true,
"mainPid": 1,
"locked": 9,
"slug": "slug",
"timestamp": 1,
"ignored": true,
"index": 6,
"downvotes": 9,
"icons": {},
"tags": {},
"bookmark": {},
"deleted": 9,
"postcount": 6,
"viewcount": 5,
"titleRaw": "titleRaw",
"votes": 3,
"category": {},
"user": {},
"cid": 1,
"teaser": {}
}
],
"isNotWatched": true,
"reputation:disabled": 2,
"isWatched": true,
"isIgnored": true,
"topic_count": 9,
"url": "url",
"imageClass": "imageClass",
"feeds:disableRSS": 1,
"loggedIn": true,
"name": "name",
"isSection": 1,
"post_count": 7,
"relative_path": "relative_path",
"breadcrumbs": [
{},
{}
],
"cid": 0
}
]
This api can updated the category details based on the category id which we created previously
- The endpoint for Category is
/v2/categories/{cid}
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}
PUT /api/discussion/v2/categories/{cid} HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Accept: */*
Content-Length: 100
{
"description": "Nodejs Tutorial",
"bgColor": "White",
"color": "black",
"parentCid": 1,
"class": "category"
}
{
"code": "code",
"payload": {
"color": "color",
"numRecentReplies": "numRecentReplies",
"icon": "icon",
"link": "link",
"description": "description",
"topic_count": "topic_count",
"imageClass": "imageClass",
"parentCid": 6,
"descriptionParsed": "descriptionParsed",
"bgColor": "bgColor",
"name": "name",
"disabled": "disabled",
"post_count": "post_count",
"isSection": "isSection",
"class": "class",
"slug": "slug",
"cid": 0,
"order": "order"
}
}
This api allows the user to delete the existing category by using categoryID from nodebb
- The endpoint for Category is
/v2/categories/{cid}
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}
DELETE /api/discussion/v2/categories/{cid} HTTP/1.1
Host: staging.sunbirded.org
Accept: */*
{
"code": "code",
"payload": {}
}
This api can get the list of category moderators based on the category ID that we created previously
- The endpoint for Category is
/v2/categories/{cid}/moderators
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}/moderators
GET /api/discussion/v2/categories/{cid}/moderators HTTP/1.1
Host: staging.sunbirded.org
Accept: */*
{
"uid": 8,
"username": "content_reviewer_tn1970",
"userslug": "content_reviewer_tn1970",
"picture": null,
"displayname": "content_reviewer_tn1970",
"icon:text": "C",
"icon:bgColor": null
}
This api allow the user to enable the category(If the category is in disable state)
- The endpoint for Category is
/v2/categories/{cid}/state
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}/state
PUT /api/discussion/v2/categories/{cid}/state HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
"code": "code",
"payload": {}
}
This api allow the user to add privilages for category in nodebb.
- The endpoint for Category is
/v2/categories/{cid}/privileges
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}/privileges
PUT /api/discussion/v2/categories/{cid}/privileges HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 22
"groups:topics:create"
{
"code": "code",
"payload": {}
}
This api allow user to remove privileges for a category in nodebb.
- The endpoint for Category is
/v2/categories/{cid}/state
- The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
- Backend Route: http://nodebb-service:4567/discussions/api/v2/categories/{cid}/privileges
DELETE /api/discussion/v2/categories/{cid}/privileges HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
"code": "code",
"payload": {}
}
Last updated
Was this helpful?