{"id":3565,"date":"2016-04-27T11:31:28","date_gmt":"2016-04-27T17:31:28","guid":{"rendered":"http:\/\/benincosa.com\/?p=3565"},"modified":"2016-04-27T11:31:28","modified_gmt":"2016-04-27T17:31:28","slug":"jenkins-spark-integration","status":"publish","type":"post","link":"https:\/\/benincosa.com\/?p=3565","title":{"rendered":"Jenkins Spark integration"},"content":{"rendered":"<p>You can make Jenkins publish messages to spark after or during builds. \u00a0Here&#8217;s how we do this:<\/p>\n<p>1. Get the spark room ID that you want to use:<\/p>\n<pre class=\"lang:sh decode:true \">curl https:\/\/api.ciscospark.com\/v1\/rooms -X GET -H \"Authorization:Bearer SUPERLONGAUGZjg5ZjRhZDAtMDA1NC00OMzRmMjg5NTJiMTUwOTZkZDgtYTY0\" | python -m json.tool<\/pre>\n<p>This will give you a list of rooms. \u00a0From here, you can find the room you want and get the ID of the room: Something like:\u00a0Y2lzY29zcGFtxuovL3VzL1JPT00vOWRhMjY1MDAtOWY2Zi0xMWU1LTg0ODQtNzczOTMxZTUxMGE3<\/p>\n<p>2. \u00a0In jenkins we can now notify the room of a build before the build or after the build by using the execute command plugin. \u00a0Putting a simple curl command like the below will create the command necessary to notify the spark room:<\/p>\n<pre class=\"lang:sh decode:true \">curl https:\/\/api.ciscospark.com\/v1\/messages \\\r\n-X POST -H \"Authorization:Bearer \\\r\n Zjg5ZjRhZDAtMDA1NC00ODM0LTkyNTAtNm...\" \\\r\n --data \"roomId=Y2lzY29zcGFyazovL3VzL1JPT...\" \\\r\n --data \"text=$JOB_NAME%20build%20$BUILD_ID%20completed\"<\/pre>\n<p>Just\u00a0substitute in the roomId and Authorization token. \u00a0You can also create a person using a different email account to make a &#8216;jenkins user&#8217;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can make Jenkins publish messages to spark after or during builds. \u00a0Here&#8217;s how we do this: 1. Get the spark room ID that you want to use: curl https:\/\/api.ciscospark.com\/v1\/rooms -X GET -H &#8220;Authorization:Bearer SUPERLONGAUGZjg5ZjRhZDAtMDA1NC00OMzRmMjg5NTJiMTUwOTZkZDgtYTY0&#8221; | python -m json.tool This will give you a list of rooms. \u00a0From here, you can find the room you&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[990,1],"tags":[830,816,729,831],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3565"}],"collection":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3565"}],"version-history":[{"count":2,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3565\/revisions"}],"predecessor-version":[{"id":3567,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3565\/revisions\/3567"}],"wp:attachment":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}