REST API v3: API to add comment and label on to the pull request without having the file name

I see APIs for adding comments and label for issues.

There is an API to post comment on pull request with file name as input.

I am looking for some API using which I can add label and comment on to the Pull Request just by having Pull Request number (just not specific to commit, file or line number)

I would appreciate if you point out to any such APIs.

1 Like

From the documentation:

The Issue Comments API supports listing, viewing, editing, and creating comments on issues and pull requests.

 So use the standard API for creating a comment.

I hope that helps!

1 Like

Hi @lee-dohm 

I bumped into the same problem. As you said, the document you linked says:

> “The Issue Comments API supports listing, viewing, editing, and creating comments on issues and pull requests.”

> https://developer.github.com/v3/issues/comments/#create-a-comment

But there is no description about “how to comment on pull requests”, just includes API to post a comment on issues (POST /repos/:owner/:repo/issues/:issue_number/comments).

I tried following API.

* POST /repos/:owner/:repo/issues/:pull_umber/comments

* POST /repos/:owner/:repo/pulls/:pull_number/comments

Sorry I resolved. I succeeded to a regular comment on PR by:

POST /repos/:owner/:repo/issues/:pull_number/comments

Hi @c-bata . How did you comment on the PR ? (I mean how did you authenticate yourself with the auth token). Can you paste the code block here for authentication of user with auth token…

I just send a http request using curl with Authorization header.

Can you tell how can I do it with python ? I tried many ways and searched on web but could not find any helpful reference.

@c-bata  Can you tell how can I do it with python ? I tried many ways and searched on web but could not find any helpful reference.

This thread might be useful.