# Public API - how do I retrieve list of comments along w/ object the comment relates to?

**URL:** <https://community.bluescape.com/t/public-api-how-do-i-retrieve-list-of-comments-along-w-object-the-comment-relates-to/3645>\
**Category:** Developer\
**Tags:** api\
**Created:** [May 18, 2023, 11:34pm UTC](https://community.bluescape.com/t/public-api-how-do-i-retrieve-list-of-comments-along-w-object-the-comment-relates-to/3645 "2023-05-18T23:34:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kkoechley](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/kkoechley/32/2474_2.png) [@kkoechley](https://community.bluescape.com/u/kkoechley)\
**Post date:** [May 19, 2023, 12:34am UTC](https://community.bluescape.com/t/public-api-how-do-i-retrieve-list-of-comments-along-w-object-the-comment-relates-to/3645/2 "2023-05-19T00:34:48Z")

</div>

Users can leave comments on workspace elements, and you can programmatically query elements to get comments, or write new comments on workspace elements.

In order to get comments in elements in a workspace, you will need to query the specific workspace to [find the elements in the workspace](https://community.bluescape.com/t/how-to-find-elements-in-a-workspace/2134).

This easily done with graphQL by using our [graphQL playground](https://api.apps.us.bluescape.com/v3/graphql) to view the documentation in the docs tab.

Here is an example of documentation for `elements.shape.comments` to get the comments for a shape

 ![image](https://us1.discourse-cdn.com/bluescape/original/2X/c/c457e1274b32ed266464abeff6f9b89d38237356.png)

An example graphQL query to get comments for all elements in a workspace:

```auto
query getElementsComments{
    elements(workspaceId: "IPvtDuI2Eh7DAdsI6ciu") { 
      __typename
      elementId:id
      comments{
          commenterName
          createdAt
          id
          text
      }
    }
}

```

**Sample response:**

```auto
{
    "data": {
        "elements": [
            {
                "__typename": "Text",
                "elementId": "6466901110163c060883a653",
                "comments": []
            },
            {
                "__typename": "Shape",
                "elementId": "6466918210163c060883a666",
                "comments": [
                    {
                        "commenterName": "Kevin Koechley",
                        "createdAt": "2023-05-19T00:02:36.074Z",
                        "id": "6466bc9c24c6a204e1833c22",
                        "text": "this is a comment"
                    }
                ]
            }
        ]
    }
}

```

You can also only return elements by type instead of all element types.

For example, only return Shape elements:

```auto
query getElementsComments{
    elements(workspaceId: "IPvtDuI2Eh7DAdsI6ciu") {
        #only return data about shape elements
        ... on Shape{
            __typename
            shapeId:id
            comments{
                commenterName
                createdAt
                id
                text
            }
        }
    }
}

```

**Sample Response:**

```auto
{
    "data": {
        "elements": [
            {
                "__typename": "Shape",
                "shapeId": "6466918210163c060883a666",
                "comments": [
                    {
                        "commenterName": "Kevin Koechley",
                        "createdAt": "2023-05-19T00:02:36.074Z",
                        "id": "6466bc9c24c6a204e1833c22",
                        "text": "this is a comment"
                    }
                ]
            }
        ]
    }
}

```

You can also use the elements REST query using our [API reference](https://api.apps.us.bluescape.com/docs/doc/us/elementary) for Elements list [v3/workspaces/{workspace}elements](https://api.apps.us.bluescape.com/docs/doc/us/elementary#/Elements/RestQueryController.find) endpoint

I hope this helps!

---

_[View the full topic](https://community.bluescape.com/t/public-api-how-do-i-retrieve-list-of-comments-along-w-object-the-comment-relates-to/3645)._
