📙
Sunbird Lern
AskDot
  • LEARN
    • Overview
    • Functional Capabilities
    • Technical Architecture
      • Technical Architecture Diagram
      • Tech Stack
    • Dependencies
    • Product Roadmap
  • USE
    • Overview
    • Release Notes
      • Release V 8.0.0 (Ongoing)
      • Release V 7.0.0
      • Release V 5.4.0
      • Release V 5.3.0
      • Release V 5.2.0
      • Release V 5.1.0
      • Release V 5.0.1
      • Release V 5.0.0
      • Release V 4.10.0
      • Release V 4.9.0
      • Release V 4.8.0
      • Release V 4.7.0
    • Developer Guide
      • USER & ORG SERVICE
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Keycloak Local setup
          • Additional Installation Dependencies:
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
              • User
              • Organisation
              • System Settings
              • Role
              • Bulk Upload Process
              • Tenant Preference
              • Cassandra Migration Version
              • User Consent
              • Email Template
              • OTP
              • Page Management (LMS Service)
              • Location
              • User Notes
              • Deprecated
          • Elastic Search
          • Redis
        • APIs
          • User Management
            • User Deletion API
            • Ownership Transfer API
          • Organisation Management
          • Location Management
          • Consent Management
          • OTP Services
          • Tenant Configurations
          • Bulk Upload
          • System Settings
          • API Management Service
          • Data Sync
          • Notification APIs
        • Flink Jobs
          • User Cache Updater
          • User Deletion Cleanup Flink Job
          • Ownership Transfer Flink Job
        • Reports
          • Standard Exhaust
            • State Admin Geo report
            • State Admin Report
          • Other Jobs
            • User Cache Indexer Job
            • Delete Users Assets Report
          • Data Products Developer Installation
            • System Requirements
            • Tech Stack
            • Installation Dependencies
            • Local installation of data-products
            • Server setup Guide
            • Installation Configuration
            • Data-product creation guide
            • Troubleshooting a data-product
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
          • System Settings
          • Email Configuration
          • SMS Configuration
          • OTP based SMS Configuration
        • Roles
          • System Roles
          • User Roles
          • RBAC
        • Dependencies
        • Keycloak on Sunbird
        • How to Guide
          • Create Organization
          • Create User
          • Add new user type & location
        • Single Sign-on with Sunbird
        • Caching and Denormalising User Metadata
          • ETLUserCacheUpdaterJob
          • UserCacheUpdaterFlinkJob
        • Unit Tests and Code Coverage
        • FAQs
      • LMS(BATCH) SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
        • Data Models
          • Cassandra
            • Data Dictionary
          • ElasticSearch
          • Redis
        • APIs
        • Flink Jobs
          • Merge User Courses
          • Relation Cache Updater
          • Activity Aggregate Updater
          • Assessment Aggregator
          • Enrolment Reconciliation
          • Collection Certificate Pre-Processor
          • Collection Certificate Generator
        • Reports
          • On-Demand Exhaust
            • Response Exhaust
            • User Info Exhaust
            • Progress Exhaust
          • Other Jobs
            • Collection Summary Job
            • Course Batch Status Updater Job
            • Cassandra Migrator Job
            • Score Metric Migration Job
            • Assessment Score Correction Job
            • Collection Reconciliation Job
            • Course Enrollment Job
            • Course Consumption Job
        • Logs, Telemetry Events
        • Configuration
          • System Configuration
          • Functional Configuration
        • Dependencies
        • Certificate Registry and Credentialing using Sunbird-RC
          • Configuring PublicKey in Sunbird-RC
          • Server Setup guide for Sunbird-RC
          • API Guide For Sunbird-RC
        • Certificate Flow
          • Certificates Creation and Configuration
        • FAQs
      • GROUPS
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
          • Redis
        • APIs
          • Create Group
        • Logs, Telemetry Events
          • UI Telemetry Events
          • Service Telemetry Events
        • Configuration
          • Functional Configurations
        • Design References
        • Dependencies
        • Unit Tests and Code Coverage
      • NOTIFICATION SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Data Dictionary
        • APIs
        • Flink Jobs
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
        • Dependencies
        • Unit Tests and Code Coverage
      • DISCUSSION FORUM
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
            • Nodebb setup
            • Discussion Middleware Setup
            • Discussion Middleware
            • Discussion forum integration with any application
            • Discussion-UI setup along with demo application.
            • Sunbird-lern portal for DF
          • Source Code
        • APIs
          • Category APIs
          • User APIs
          • Post APIs
          • Topic APIs
          • Forum APIs
        • Context Schema
        • Configurations
          • Nodebb Admin panel settings
          • Discussion MW & Nodebb System Config
        • Telemetry Events
        • Dependencies
      • ML SERVICE
        • DATA PIPELINE (Flink Jobs)
          • Program User Info
            • Component Diagram
            • Data Model
            • Folder Structure
          • Ml User Delete
            • Component Diagram
            • Data Model
            • Folder Structure
        • DATA PRODUCTS
          • Program Exhaust
            • Component Diagram
            • Folder Structure
    • Server Installation
    • Dependency setup
    • Deprecation
      • Release-5.4.0
    • Jenkins Jobs
    • Release Calendar
    • Learn More
      • Tech References
      • Telemetry Processing
      • Data Dictionary
        • Sample Data
      • Delete User Functionality
      • Asset Ownership Transfer
    • FAQs
  • Engage
    • Discuss
    • Contribute to Sunbird Lern
    • Raise an Issue
    • Contribution Guidelines
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. USE
  2. Developer Guide
  3. DISCUSSION FORUM
  4. APIs

Category APIs

PreviousAPIsNextUser APIs

Last updated 1 year ago

Was this helpful?

Get category details

get

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

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

Delete the Category

delete

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

  • 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
Path parameters
cidintegerRequired
Header parameters
AuthorizationstringOptional
Responses
200
successful operation
application/json
400
Bad request
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)

  • 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
Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
put
PUT /api/discussion/v2/categories/{cid}/state HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Remove privileges for a category

delete

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
Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
delete
DELETE /api/discussion/v2/categories/{cid}/privileges HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}
  • POSTAdd a new category
  • GETGet category details
  • GETGet the category details by category id
  • POSTGet List of category details
  • PUTUpdates already existing catrgory details
  • DELETEDelete the Category
  • GETGet the moderators list for a category
  • PUTEnable category
  • PUTAdd privileges to category
  • DELETERemove privileges for a category

Add a new category

post

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

  • 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
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
400
Bad request
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

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

Add privileges to category

put

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