How to post the comments on GitHub pull request page using curl.exe?

Are there any possibilities to post the comments on Github pull request page using curl.exe?

I have used the below as below mentioned commands, but it’s not working. Could you suggest a solution for this?

curl -s -H “UserName:Token” -X POST -d ‘{“body”: “My Review comments”}’ ""

Hi @ElangoRajendran ,

You did not give a clue as to what error you are getting? Also running curl with debug options rather than -s (silent) can help you when trying to debug errors

I checked myself and was able to successfully POST using REST API using format in Docs

I then compared against what you had and noticed your authentication header record formatting looks wrong.
Using the curl format and syntax you have used the following worked for me, replace your values between {}
curl -H ‘Authorization: Token {your-token-value}’ -X POST -d ‘{“body”: “My Review comments”}’ ‘{owner}/{repo}/issues/{issue_number}/comments

Give this a try and let us know if this works for you now. Good luck

Hi @byrneh ,

Thanks for the update. I have tried as you like mentioned but still i have faced below mentioned issue. Could you suggest to resolve this issue ?

My Command:
curl -H ‘Elango: Token {6XXXXXXXXXa}’ -X POST -d ‘{“body”: “My Review comments”}’ ‘

Error details:
curl: (6) Could not resolve host: Token
curl: (3) Failed to convert 6XXXXXXXXXXXa’ to ACE; string contains a disallowed character
curl: (3) unmatched close brace/bracket in URL position 19:
My Review comments}’

Also, if there any possibilities of share here your worked command, Its more helpful for me ?

Try this
If my token was 1234567890 then
curl -H ‘Authorization: Token 1234567890’ -X POST -d ‘{“body”: “My Review comments”}’

Hi @byrneh,

Still, I have faced the below issue, I have tried the below-mentioned command.


curl -H ‘Elango: Token 6XXXXXXXXXa’ -X POST -d ‘{“body”: “My Review comments”}’ ‘


I want to post the comment in the pull request comment section. I can able to post the comment manually(directly) but while trying to post the comment using API cant able post, as the above-shared issue facing.

Could you help to resolve the issue?

HI @ElangoRajendran, I tested the syntax in Git Bash. Can you please repeat the command using Git Bash shell command line.
note there is on a single ‘/’ after

If that works, and you still wish to use Windows command prompt it should be simple matter of adjusting the command syntax for differences in syntax between Bash and Windows command line.
Still feeling hopeful, and have my fingers crossed for you :slight_smile:

Hi @byrneh,

Thanks for the update, still I have faced this issue?
Could you suggest how to resolve this issue?


curl -H ‘Elango: Token 6cXXXXXXXXXa’ -X POST -d ‘{“body”: “My Review comments”}’ ‘

Error Snap:

Elango R.

You have accidentally replaced text “Authorization” with “Elango” in the Header it seems, give it retry, and lets hope for success :slight_smile:
curl -H ‘Authorization: Token 6cXXXXXXXXXa’ -X POST -d ‘{“body”: “My Review comments”}’