0

I am using Paw, an application to test REST requests. I have the follow request working using the application but need to change it to use cURL to use in my ruby on rails application.

POST /rest/api/latest/result/TRUNKDEVQAUNIT-TESTANDRGITBUILDDEV-12/comment HTTP/1.1 Content-type: application/json Accept: application/json Authorization: Basic dWkud29ya2JvdDpFVmgzUFQ0dEch Cookie: JSESSIONID=C851F60AFB4A83F12753B9CCBC745093 Host: bamboo10.com Connection: close User-Agent: Paw/2.2.5 (Macintosh; OS X/10.10.5) GCDHTTPRequest Content-Length: 32

{"content":"here is a comment, for testing purposes“}

I think it should look something like this but it is not working. I did not add the real username and password (or host) in for security reasons. Any help would be much appreciated. Thank you!

`curl -X POST -u username:password --data {"body": "This is a comment, for testing purposes"} -H "Accept: application/json" -H "Content-type: application/json" https://bamboo.com/rest/api/latest/result/TRUNKDEVQAUNIT-TESTANDRGITBUILDDEV-12/comment`

Scott B
  • 1,478
  • 2
  • 16
  • 26

1 Answers1

1

After a little time, I found the correct way to do it. It appears I was missing a ' before and after the data, as well as changing the json element to be content and not body

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -u username:password -d '{"content": "This is a comment, for testing purposes"}' https://bamboo10.com/rest/api/latest/result/TRUNKDEVQAUNIT-TESTANDRGITBUILDDEV-12/comment

Scott B
  • 1,478
  • 2
  • 16
  • 26