Forum APIs

Get Forum Id

post

This api allow the user to get the forum id

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

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

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

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

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

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

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

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 all tags

get

This api is used to fetch tags from nodebb.

Header parameters
AuthorizationstringRequired
Responses
200
successful operation
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"
  }
]

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

Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
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.

Header parameters
AuthorizationstringRequired
Body
Responses
200
successful operation
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"
}

Last updated

Was this helpful?