-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
})(); |