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
{ | |
"result": [ | |
{ | |
"parent": "CS0001015", | |
"related_party_consumers": "", | |
"case_action_summary": "CAS0001001", | |
"caused_by": "", | |
"watch_list": "", | |
"related_party_users": "", | |
"active_escalation": "", |
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
//index.js | |
var pwd = 'replace with password' | |
var opt = {username: "subscribe",port: 8883 ,password: pwd, rejectUnauthorized: false} | |
var mqtt = require('mqtt') | |
var client = mqtt.connect('mqtts://broker.iotdemo2-dev.sniot.net', opt) | |
client.on('connect', function () { | |
client.subscribe('sniothub/rules/message', function (err) { | |
if (!err) { | |
console.log("successfully connected") |
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
/* | |
Make HTTP Request using RESTMessageV2 | |
*/ | |
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'); |
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
#Need to install requests package for python | |
#easy_install requests | |
import requests | |
# Request Docs: http://docs.python-requests.org/en/master/user/quickstart/ | |
# Set the request parameters | |
url = 'https://bbarnsc1.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id=81f8915bdb6ba20028927416bf961971&file_name=issue_screenshot' | |
# url = 'https://fejr5sb8ead6.runscope.net/api/now/attachment/file?table_name=incident&table_sys_id=81f8915bdb6ba20028927416bf961971&file_name=issue_screenshot' |
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
# This example uses the Python Requests Library and you will need to install requests package for python | |
# Documentation can be found at http://docs.python-requests.org/en/master/user/quickstart/ | |
import requests | |
import pprint | |
import json | |
# Specify the Endpoint URL replacing {servicenow_instance_name} with your ServiceNow Instance Name | |
url = 'https://{servicenow_instance_name}.service-now.com/api/now/attachment/upload' |
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
var tablename = 'incident'; | |
var recordSysId = '3197671513d75200a54fb8b12244b0f6'; | |
var filename = 'new_image.jpeg'; | |
var request = new sn_ws.RESTMessageV2(); | |
request.setHttpMethod('get'); | |
request.setEndpoint('https://demonightlyus.service-now.com/api/now/attachment/2b6644b15f1021001c9b2572f2b47763/file'); | |
request.saveResponseBodyAsAttachment(tablename, recordSysId, filename); | |
request.setBasicAuth('admin', '{update_with_password'); | |
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
/** | |
* sample http request using RESTMessageV2 server side api | |
*/ | |
(function sample_http_request() { | |
try { | |
var request = new sn_ws.RESTMessageV2(); | |
request.setHttpMethod('get'); | |
request.setEndpoint('https://api.myjson.com/bins/4j985'); | |
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
/** | |
* sample http request in servicenow using RESTMessageV2 server side api | |
* tested running in ServiceNow Geneva Release as a background script in global scope | |
*/ | |
(function sample_http_request() { | |
try { | |
var request = new sn_ws.RESTMessageV2(); | |
request.setHttpMethod('get'); | |
request.setEndpoint('https://api.myjson.com/bins/4j985'); | |
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
HTTP/1.1 200 OK | |
Link: <https://demo003.service-now.com/api/now/table/incident?sysparm_limit=1&sysparm_fields=number%2Clocation%2Clocation.name%2Clocation.city&sysparm_offset=0>;rel="first",<https://demo003.service-now.com/api/now/table/incident?sysparm_limit=1&sysparm_fields=number%2Clocation%2Clocation.name%2Clocation.city&sysparm_offset=-1>;rel="prev",<https://demo003.service-now.com/api/now/table/incident?sysparm_limit=1&sysparm_fields=number%2Clocation%2Clocation.name%2Clocation.city&sysparm_offset=1>;rel="next",<https://demo003.service-now.com/api/now/table/incident?sysparm_limit=1&sysparm_fields=number%2Clocation%2Clocation.name%2Clocation.city&sysparm_offset=549>;rel="last" | |
X-Total-Count: 550 | |
Content-Type: application/json | |
Transfer-Encoding: chunked | |
Date: Fri, 25 Sep 2015 21:33:32 GMT | |
Server: ServiceNow | |
Connection: close | |
{ |
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
GET /api/now/table/incident?sysparm_limit=1&sysparm_fields=number%2Clocation%2Clocation.name%2Clocation.city HTTP/1.1 | |
Authorization: <removed> | |
Accept: application/json | |
Host: demo003.service-now.com | |
Connection: close |
NewerOlder