Comments
Get Comments
POST
https://sketchub.in/api/v2/view_comments.php
To obtain list of all comments on project.
Body
Response
{
"status": "success",
"author_uid": 736,
"data": "[{\"uid\":\"736\",\"username\":\"Kannan_O_V\",\"badge\":\"0\",\"profilepic\":\"https:\\/\\/sketchub.in\\/storage\\/user_avatars\\/736.png\",\"id\":\"175\",\"project_id\":\"122\",\"message\":\"suggestions please to improve project please\",\"comment_type\":\"default\",\"timestamp\":\"1596378676000\"},{\"uid\":\"958\",\"username\":\"tarocafe\",\"badge\":\"60\",\"profilepic\":\"https:\\/\\/sketchub.in\\/storage\\/user_avatars\\/958.png\",\"id\":\"194\",\"project_id\":\"122\",\"message\":\"Your app is lagging! I recommend to create temporary for videos thumbnails, and to not generate thumbnails on \\\"onBindCustomView\\\" but when the app is listing all the videos on a ListMap !\",\"comment_type\":\"default\",\"timestamp\":\"1596412553000\"},{\"uid\":\"736\",\"username\":\"Kannan_O_V\",\"badge\":\"0\",\"profilepic\":\"https:\\/\\/sketchub.in\\/storage\\/user_avatars\\/736.png\",\"id\":\"197\",\"project_id\":\"122\",\"message\":\"thank you @Downachino\",\"comment_type\":\"default\",\"timestamp\":\"1596415303000\"},{\"uid\":\"61639\",\"username\":\"Kelvin_0644\",\"badge\":\"0\",\"profilepic\":\"https:\\/\\/ui-avatars.com\\/api\\/?size=150&bold=true&rounded=true&name=Kelvin0466&background=124CA3&color=fff\",\"id\":\"30034\",\"project_id\":\"122\",\"message\":\"malayali ano\",\"comment_type\":\"default\",\"timestamp\":\"1628753410000\"}]"
}
Pinned messages
Tip: If the message is in format of /pin title:<TITLE HERE> message:<Message HERE>, then it is pinned message by the project author or Sketchub admin. You may follow this method to get pinned messages that format:
public boolean checkPinned(HashMap<String, String> child) {
String message = child.get("message");
String type = child.get("comment_type");
if (type == null) {
type = "";
}
if (message == null) {
return false;
}
if (message.startsWith("/pin")) {
try {
int titleIndex = message.indexOf("title:");
int messageIndex = message.indexOf("message:");
if (titleIndex == -1 || messageIndex == -1) {
return false;
}
String title = message.substring(titleIndex + "title: ".length(), messageIndex - 1);
String msg = message.substring(messageIndex + "message: ".length());
showPinnedView(true, title, msg);
return true;
} catch (Exception e) {
return false;
}
}
return false;
}
Submit Comment
POST
https://sketchub.in/api/v2/post_comment.php
This endpoint will post comment if allowed by the project's configuration.
Body
Response
{
"status": "success",
"id": 133842, //comment id
"message": "Comment added successfully",
"status_code": "OK"
}
Mention an user
If you want to mention an user in your message to notify him. You can simply add @user_name
in the message and the server will handle rest.
Delete a comment
POST
https://sketchub.in/api/v2/delete_comment.php
Using this endpoint, you can delete project comment. Please note that user can only delete his own comments, or other's comments on his own project. And ofcourse, if the user_badge is 40 or greator, it means he is moderator, API will also allow him to delete any comment.
Body
Response
{
"status": "success",
"message": "Comment deleted successfully",
"status_code": "OK"
}
Last updated
Was this helpful?