Comments

Get Comments

POST https://sketchub.in/api/v2/view_comments.php

To obtain list of all comments on project.

Body

Name
Type
Description

project_id

number

Project ID for which you want to view the comments.

email

string

RSA Encrypted Email

password

string

RSA Encrypted Password

api_key

string

Your API Key

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\"}]"
}

The comment list is in ascending order of timestamp. Perhaps, latest comments will be in bottom.

If the comment_type is anonymous, then it is message by our team member

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

Name
Type
Description

project_id

number

Project ID for which you want to view the comments.

message

string (0 to 1000 Chars)

Message content.

comment_type

string

The value must be default

email

string

RSA Encrypted Email

password

string

RSA Encrypted Password

api_key

string

Your API Key

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

Name
Type
Description

comment_id

number

The comment's unique id

uid

number

The user id who is deleting it.

email

string

RSA Encrypted Email

password

string

RSA Encrypted Password

api_key

string

Your API Key

Response

{
  "status": "success",
  "message": "Comment deleted successfully",
  "status_code": "OK"
}

Last updated

Was this helpful?