Post APIs
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
}
}
}
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
}
}
}
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": {}
}
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": {}
}
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": {}
}
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": {}
}
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": {}
}
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": {}
}
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": {}
}
Last updated
Was this helpful?