0

I setup a bot to perform my continuous integration. But I need to send info about coverage to my database using its own API.

Using following address: http://lb.mycompany.org/api/public/metrics I need to send a POST with following parameters:

{"project_public_id": "myprojectid", "type": "coverage", "value": "50", "platform": "ios"}

enter image description here

How can I do this? How to access code coverage from within trigger script?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

0

You can use, but I don't know how to get coverage value. Example for XCS_TESTS_COUNT:

curl -i -X POST -H "Content-Type:application/json" your_http_address -d '{"value":'$XCS_TESTS_COUNT'}'
P. Pawluś
  • 298
  • 6
  • 17
  • 1
    You want double quotes inside the single quotes. JSON uses double quotes around strings, and the entire JSON snippet will be in single quotes. (This means you can't interpolate a shell variable within the JSON snippet, but that's easy to do with something like `'{"key": "value", "key2", "'"$shell_variable"'"}'`. See further http://stackoverflow.com/questions/10067266/when-to-wrap-quotes-around-a-variable – tripleee Oct 26 '16 at 14:43