📙
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

Post APIs

PreviousUser APIsNextTopic APIs

Last updated 2 years ago

Was this helpful?

Delete a post by postID

delete

This api allows the user to delete post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
delete
DELETE /api/discussion/v2/posts/{pid} HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Remove votes for a post by postID

delete

This api allows the user to delete vote(Up/down) to post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/vote
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/vote
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
delete
DELETE /api/discussion/v2/posts/{pid}/vote HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Bookmarks a post by postID

post

This api allows the user to bookmarks a post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/bookmark
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/bookmark
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
post
POST /api/discussion/v2/posts/{pid}/bookmark HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Removes bookmarks for a post by postID

delete

This api allows the user to Unbookmarks a post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/bookmark
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/bookmark
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
delete
DELETE /api/discussion/v2/posts/{pid}/bookmark HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Restores a post

put

This api allows the user to Restores a post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/state
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/state
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
put
PUT /api/discussion/v2/posts/{pid}/state HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}

Vote a post by postID

post

This api allows the user to vote(Up/down) to post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/vote
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/vote
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Body
deltaintegerRequired

delta must be a number. If delta > 0, it's considered an upvote; if delta < 0, it's considered a downvote; otherwise, it's an unvote.

Responses
200
successful operation
application/json
400
Bad request
application/json
post
POST /api/discussion/v2/posts/{pid}/vote HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 11

{
  "delta": 1
}
{
  "code": "code",
  "payload": {}
}

Deletes a post (Soft-delete)

delete

This api allows the user to Deletes a post in the nodebb

  • The endpoint for Post is /v2/posts/{pid}/state
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
  • Backend Route: http://nodebb-service:4567/discussions/api/v2/posts/{pid}/state
Path parameters
pidintegerRequired
Header parameters
AuthorizationstringRequired
Responses
200
successful operation
application/json
400
Bad request
application/json
delete
DELETE /api/discussion/v2/posts/{pid}/state HTTP/1.1
Host: staging.sunbirded.org
Authorization: text
Accept: */*
{
  "code": "code",
  "payload": {}
}
  • POSTCreate new post
  • POSTCreate reply to post
  • DELETEDelete a post by postID
  • POSTVote a post by postID
  • DELETERemove votes for a post by postID
  • POSTBookmarks a post by postID
  • DELETERemoves bookmarks for a post by postID
  • PUTRestores a post
  • DELETEDeletes a post (Soft-delete)

Create new post

post

This api allow the user to create new post to topic in nodebb

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

{
  "content": "Example reply to topic",
  "toPid": 1
}
{
  "code": "code",
  "payload": {
    "topicData": {
      "pinned": 4,
      "lastposttime": 6,
      "upvotes": 7,
      "unreplied": 6,
      "mainPost": {},
      "unread": true,
      "timestampISO": "timestampISO",
      "title": "title",
      "teaserPid": {},
      "tid": 5,
      "uid": 7,
      "lastposttimeISO": "lastposttimeISO",
      "deleterUid": 1,
      "isOwner": true,
      "mainPid": 1,
      "locked": 2,
      "slug": "slug",
      "timestamp": 2,
      "ignored": true,
      "downvotes": 1,
      "icons": {},
      "tags": {},
      "bookmark": {},
      "deleted": 3,
      "postcount": 5,
      "viewcount": 9,
      "titleRaw": "titleRaw",
      "votes": 1,
      "category": {},
      "user": {},
      "cid": 0,
      "teaser": {}
    },
    "postData": {
      "isMain": true,
      "bookmarked": true,
      "selfPost": true,
      "index": 9,
      "pid": 7,
      "timestampISO": "timestampISO",
      "display_edit_tools": true,
      "tid": 4,
      "content": "content",
      "uid": 1,
      "display_moderator_tools": true,
      "display_move_tools": true,
      "topic": {},
      "votes": 6,
      "display_delete_tools": true,
      "user": {},
      "timestamp": 5,
      "cid": 9
    }
  }
}

Create reply to post

post

This api allow the user to create reply to post in nodebb

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

{
  "content": "Example reply to topic",
  "toPid": 1
}
{
  "code": "code",
  "payload": {
    "topicData": {
      "pinned": 4,
      "lastposttime": 6,
      "upvotes": 7,
      "unreplied": 6,
      "mainPost": {},
      "unread": true,
      "timestampISO": "timestampISO",
      "title": "title",
      "teaserPid": {},
      "tid": 5,
      "uid": 7,
      "lastposttimeISO": "lastposttimeISO",
      "deleterUid": 1,
      "isOwner": true,
      "mainPid": 1,
      "locked": 2,
      "slug": "slug",
      "timestamp": 2,
      "ignored": true,
      "downvotes": 1,
      "icons": {},
      "tags": {},
      "bookmark": {},
      "deleted": 3,
      "postcount": 5,
      "viewcount": 9,
      "titleRaw": "titleRaw",
      "votes": 1,
      "category": {},
      "user": {},
      "cid": 0,
      "teaser": {}
    },
    "postData": {
      "isMain": true,
      "bookmarked": true,
      "selfPost": true,
      "index": 9,
      "pid": 7,
      "timestampISO": "timestampISO",
      "display_edit_tools": true,
      "tid": 4,
      "content": "content",
      "uid": 1,
      "display_moderator_tools": true,
      "display_move_tools": true,
      "topic": {},
      "votes": 6,
      "display_delete_tools": true,
      "user": {},
      "timestamp": 5,
      "cid": 9
    }
  }
}