Pull request review body is empty if state is COMMENTED

Hey, I get PR reviews from this endpoint:
https://docs.github.com/en/rest/reference/pulls#list-reviews-for-a-pull-request

But, review body field is always empty if review state is “COMMENTED”. Do you have any idea why this is the case?

An example: https://api.github.com/repos/microsoft/vscode/pulls/65994/reviews

So, my guess is that the body is for a top levelish comment.

Here are reviews for a pull request:
https://api.github.com/repos/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pulls/1/reviews

This last one is commented and has a body, because when I submitted the review, I chose to use comment instead of request changes:

  {
    "id": 698685436,
    "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3Njk4Njg1NDM2",
    "user": {
      "login": "jsoref",
      "id": 2119212,
      "node_id": "MDQ6VXNlcjIxMTkyMTI=",
      "avatar_url": "https://avatars.githubusercontent.com/u/2119212?u=104dafbbcf9a6b26da789e6513f15d5ca5ba41c9&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/jsoref",
      "html_url": "https://github.com/jsoref",
      "followers_url": "https://api.github.com/users/jsoref/followers",
      "following_url": "https://api.github.com/users/jsoref/following{/other_user}",
      "gists_url": "https://api.github.com/users/jsoref/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/jsoref/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/jsoref/subscriptions",
      "organizations_url": "https://api.github.com/users/jsoref/orgs",
      "repos_url": "https://api.github.com/users/jsoref/repos",
      "events_url": "https://api.github.com/users/jsoref/events{/privacy}",
      "received_events_url": "https://api.github.com/users/jsoref/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "z",
    "state": "COMMENTED",
    "html_url": "https://github.com/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pull/1#pullrequestreview-698685436",
    "pull_request_url": "https://api.github.com/repos/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pulls/1",
    "author_association": "OWNER",
    "_links": {
      "html": {
        "href": "https://github.com/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pull/1#pullrequestreview-698685436"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pulls/1"
      }
    },
    "submitted_at": "2021-07-04T15:20:43Z",
    "commit_id": "ad2fc4f3e6084066182e670e75eaa85a5830c84a"
  }

For reference, here are all of the events:
https://api.github.com/repos/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/events

The thing you’re looking for is probably:
https://api.github.com/repos/jsoref/pull-request-review-body-is-empty-if-state-is-commented-188387/pulls/1/comments

Or in your case:
https://api.github.com/repos/microsoft/vscode/pulls/65994/comments

1 Like

I can confirm @jsoref’s response: if you go on the PR in question and look at the “comment” review, the author created an inline comment then posted the review as “Comment” without a body. Therefore you don’t get a body in the review object.

Now it can look very strange because when posting a review via the API a body is required (at least according to the documentation) fort REQUEST_CHANGES and COMMENT, but I don’t think that’s the case for the web UI, if the documentation is even correct with respect to the API (I’m not sure about that).