How to retrieve order comment via REST?

Solved
Alfred27
New Member
2 0 0

I have a question about order comment. I post comment below an order, and I want to retrieve order comment. But how can I get these data? Like who post the comment, and what content he post? Can I get these information by webhook?

Accepted Solution (1)

Accepted Solutions
L_J_K
Shopify Staff
Shopify Staff
400 64 81

This is an accepted solution.

 Hey @Alfred27 

Alas, it's not possible to do this in REST presently, though you may know it's possible to get Order timeline comment events via the GraphQL Admin API. Something like this would work :

 

query {
  order(id: "gid://shopify/Order/xxxxxxxxxxxxx"){
        id
        createdAt
        hasTimelineComment
   
        events(first: 10) {
          edges {
            node {
              __typename
              id
              message
            }
      }
    }
  }
}

 

This would return you :

 

 "node": {
              "__typename": "CommentEvent",
              "id": "gid:\/\/shopify\/CommentEvent\/78327073407032",
              "message": "test comment"
            }
      }

 

I will certainly make it known as a feature request though internally. Hope that helps.

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Reply 1 (1)
L_J_K
Shopify Staff
Shopify Staff
400 64 81

This is an accepted solution.

 Hey @Alfred27 

Alas, it's not possible to do this in REST presently, though you may know it's possible to get Order timeline comment events via the GraphQL Admin API. Something like this would work :

 

query {
  order(id: "gid://shopify/Order/xxxxxxxxxxxxx"){
        id
        createdAt
        hasTimelineComment
   
        events(first: 10) {
          edges {
            node {
              __typename
              id
              message
            }
      }
    }
  }
}

 

This would return you :

 

 "node": {
              "__typename": "CommentEvent",
              "id": "gid:\/\/shopify\/CommentEvent\/78327073407032",
              "message": "test comment"
            }
      }

 

I will certainly make it known as a feature request though internally. Hope that helps.

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!