Skip to content

Commit

Permalink
new snippet
Browse files Browse the repository at this point in the history
new snippet
  • Loading branch information
Bryan Barnard committed Apr 18, 2017
0 parents commit 35864cb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ccw3970_scripts_background_restmessage_hello_pubnub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Make HTTP Request using RESTMessageV2
*/
(function executeRule() {
try {
var req = new sn_ws.RESTMessageV2('PubNub', 'Publish Message');
req.setStringParameterNoEscape('pub_key', 'pub-c-11b9ede6-f9ee-4da8-a829-944a45f29eb8');
req.setStringParameterNoEscape('client', gs.getProperty('instance_name') + '-' + gs.getProperty('instance_id'));
req.setStringParameterNoEscape('sub_key', 'sub-c-dafe9b8c-1ae1-11e7-bc52-02ee2ddab7fe');
req.setStringParameterNoEscape('channel', 'CCW3970-'+gs.getProperty('instance_name'));


var body = '{"message":"hello PubNub"}';
req.setRequestBody(body);


var res = req.execute();
var responseBody = res.getBody();
var httpStatus = res.getStatusCode();
gs.debug(httpStatus);
}
catch (ex) {
var message = ex.getMessage();
gs.debug(message);
}
})();

0 comments on commit 35864cb

Please sign in to comment.