📙
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

Forum APIs

PreviousTopic APIsNextContext Schema

Last updated 2 years ago

Was this helpful?

Get list of all tags

get

This api is used to fetch tags from nodebb.

  • The endpoint for Tags is /tags
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/tags
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
get
GET /api/discussion/tags HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
[
  {
    "value": "learning",
    "score": 1,
    "valueEscaped": "learning",
    "color": "#FFF",
    "bgColor": "#EEE"
  }
]
  • POSTGet Forum Id
  • POSTAttaching category for context
  • POSTRemove forum id
  • POSTGet nodebb uids based on sunbird id
  • POSTGet nodebb users added for a category
  • POSTAdd sunbird users into nodebb group
  • POSTGet context based tags
  • POSTGet nodebb privileges added for a category
  • GETGet list of all tags
  • POSTGet List of category details for based on tag name and cid.
  • POSTCopy privileges from one category to another category

Get Forum Id

post

This api allow the user to get the forum id

  • The endpoint for Forum is /forum/v2/read
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v2/read
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v2/read HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 62

{
  "request": {
    "type": "course",
    "identifier": "do_12345678996312"
  }
}
200

successful operation

[
  {
    "identifier": "identifier",
    "type": "type",
    "cid": 0
  }
]

Attaching category for context

post

This api allow the user to attaching category id with a context

  • The endpoint for Forum is /forum/v3/create
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v3/create
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v3/create HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 321

{
  "category": {
    "name": "Batch 1",
    "pid": 567,
    "description": "Mentors can start discussions",
    "privileges": {
      "copyFromCategory": 268
    },
    "context": [
      {
        "type": "batch",
        "identifier": "01307806402750054416"
      }
    ],
    "subcategories": [
      {
        "name": "Annoucements",
        "description": "Only creators can make annoucements",
        "privileges": {
          "copyFromParent": true
        }
      }
    ]
  }
}
200

successful operation

[
  {
    "forums": [
      {
        "sbType": "batch",
        "sbIdentifier": "01307806402750054416",
        "newCid": 580,
        "cids": [
          580
        ]
      }
    ],
    "groups": [
      {
        "name": "registered-users",
        "members": [
          {
            "uid": 29,
            "userName": "content_reviewer_tn1970",
            "sbUid": "08631a74-4b94-4cf7-a818-831135248a4a"
          }
        ]
      }
    ],
    "subcategories": [
      {
        "name": "Annoucements",
        "cid": 581,
        "pid": 580,
        "groups": [
          {
            "name": "registered-users",
            "members": [
              {
                "uid": 29,
                "userName": "content_reviewer_tn1970",
                "sbUid": "08631a74-4b94-4cf7-a818-831135248a4a"
              }
            ]
          }
        ]
      }
    ]
  }
]

Remove forum id

post

This api allow the user to remove forum id

  • The endpoint for Forum is /forum/v2/remove
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v2/remove
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v2/remove HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 59

{
  "sbType": "course",
  "cid": [
    2
  ],
  "sbIdentifier": "do_123456789"
}
200

successful operation

[
  {
    "id": "api.forum.v2.remove",
    "ver": "1.0",
    "ets": 1618421469097,
    "params": {
      "resmsgid": "01d3023f-e68f-4e5a-84dc-e67aa69dfd48",
      "msgid": "",
      "status": "Success"
    },
    "responseCode": "OK",
    "result": "Forum remove for context success"
  }
]

Get nodebb uids based on sunbird id

post

This api allow the user to get nodebb id bypassing sunbird id

  • The endpoint for Forum is /forum/v2/uids
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v2/uids
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v2/uids HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 70

{
  "request": {
    "sbIdentifiers": [
      "08631a74-4b94-4cf7-a818-831135248a4a"
    ]
  }
}
200

successful operation

[
  {
    "id": ".api.forum.v2.uids",
    "ver": "1.0",
    "ets": 1618428120524,
    "params": {
      "resmsgid": "3bf46d2d-6dd4-49e5-a2e7-6b7fa16101b3",
      "msgid": "",
      "status": "Success"
    },
    "responseCode": "OK",
    "result": {
      "userIds": [
        {
          "nodebbUid": 29,
          "sbUid": "08631a74-4b94-4cf7-a818-831135248a4a"
        }
      ]
    }
  }
]

Get nodebb users added for a category

post

This api allow the user to get nodebb users added for a category

  • The endpoint for Forum is /forum/v3/groups/users
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v3/groups/users
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v3/groups/users HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 23

{
  "request": {
    "cid": 268
  }
}
200

successful operation

[
  {
    "result": {
      "groups": [
        {
          "name": "text",
          "members": [
            {
              "uid": 1,
              "userName": "text",
              "sbUid": "text"
            }
          ]
        }
      ]
    }
  }
]

Add sunbird users into nodebb group

post

This api allow the user to add sunbird users into nodebb group

  • The endpoint for Forum is /forum/v3/groups/membership
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v3/groups/membership
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v3/group/membership HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 141

{
  "request": {
    "groups": [
      "Category Owner"
    ],
    "members": [
      {
        "sbUserName": "content_reviewer_tn1970",
        "sbUid": "08631a74-4b94-4cf7-a818-831135248a4a"
      }
    ]
  }
}
200

successful operation

[
  {
    "groups": [
      {
        "name": "text",
        "members": [
          {
            "uid": 1,
            "userName": "text",
            "sbUid": "text"
          }
        ]
      }
    ]
  }
]

Get context based tags

post

This api allow the user to get context based tags

  • The endpoint for Forum is /forum/tags
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/tags
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/tags HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 26

{
  "request": {
    "cids": [
      2,
      3
    ]
  }
}
200

successful operation

[
  {
    "value": "text",
    "valueEscaped": "text",
    "color": "text",
    "bgColor": "text",
    "score": 1
  }
]

Get nodebb privileges added for a category

post

This api allow the user to get nodebb privileges added for a category

  • The endpoint for Forum is /forum/v3/category/{cid}/privileges
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/forum/v3/category/{cid}/privileges
Path parameters
cidintegerRequired
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
post
POST /api/discussion/forum/v3/category/{cid}/privileges HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 60

{
  "request": {
    "groups": [
      "Category Owner",
      "registered-users"
    ]
  }
}
200

successful operation

[
  {
    "groups": [
      {
        "name": "text",
        "nameEscaped": "text",
        "privileges": {},
        "isPrivate": true,
        "isSystem": true
      }
    ]
  }
]

Get List of category details for based on tag name and cid.

post

This api allow the user to get all the details of category based on tag name and cid mentioned in array from nodebb

  • The endpoint for Tag is /tags/list
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/tags/list
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
400
Bad request
application/json
post
POST /api/discussion/tags/list HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 40

{
  "request": {
    "tag": "nodebb",
    "cid": [
      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
  }
]

Copy privileges from one category to another category

post

This api allow the user to copy all privileges from one category to another category.

  • The endpoint for Privileges is /privileges/v2/copy
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/privileges/v2/copy
Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
application/json
400
Bad request
application/json
post
POST /api/discussion/privileges/v2/copy HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 29

{
  "request": {
    "pid": 2,
    "cid": 3
  }
}
{
  "id": "api.forum.v2.remove",
  "ver": "1.0",
  "ets": 1618421469097,
  "params": {
    "resmsgid": "01d3023f-e68f-4e5a-84dc-e67aa69dfd48",
    "msgid": "",
    "status": "Success"
  },
  "responseCode": "OK",
  "result": "Privileges copied successfuly"
}