Category APIs

Add a new category

post

This api allows the user to create a new category in nodebb

Header parameters
AuthorizationstringRequired
Body
namestringRequired
descriptionstringRequired
bgColorstringRequired
colorstringRequired
parentCidintegerRequired
classstringRequired
Responses
200
successful operation
application/json
post
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"
  }
}

Get category details

get

This api allows the user to get all details of a category by using categoryId and slug from nodebb.

Path parameters
category_idstringRequired
slugstringRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
get
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
}

Get the category details by category id

get

This api allow the user to get all the details of categories using categoryId from nodebb

Path parameters
cidstringRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
get
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
}

Get List of category details

post

This api allow the user to get all the details of categories based on cid mentioned in array from nodebb

Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
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
  }
]

Updates already existing catrgory details

put

This api can updated the category details based on the category id which we created previously

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringOptional
Body
namestringRequired
descriptionstringRequired
bgColorstringRequired
colorstringRequired
parentCidintegerRequired
classstringRequired
Responses
200
successful operation
application/json
put
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"
  }
}

Delete the Category

delete

This api allows the user to delete the existing category by using categoryID from nodebb

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringOptional
Responses
200
successful operation
application/json
delete
DELETE /api/discussion/v2/categories/{cid} HTTP/1.1
Host: staging.sunbirded.org
Accept: */*
{
  "code": "code",
  "payload": {}
}

Get the moderators list for a category

get

This api can get the list of category moderators based on the category ID that we created previously

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringOptional
Responses
200
successful operation
application/json
get
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
}

Enable category

put

This api allow the user to enable the category(If the category is in disable state)

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
put
PUT /api/discussion/v2/categories/{cid}/state HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Add privileges to category

put

This api allow the user to add privilages for category in nodebb.

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Body
string[]Optional
Responses
200
successful operation
application/json
put
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": {}
}

Remove privileges for a category

delete

This api allow user to remove privileges for a category in nodebb.

Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
delete
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?