Skip to content

Instantly share code, notes, and snippets.

View bryanbarnard's full-sized avatar
🕶️
building

Bryan Barnard bryanbarnard

🕶️
building
View GitHub Profile
@bryanbarnard
bryanbarnard / getnote.m
Created November 12, 2012 05:50
NSURLConnection Sample
//
// SNViewController.m
// SimpleNetwork
//
// Created by Bryan Barnard on 11/11/12.
// Copyright (c) 2012 Bryan Barnard. All rights reserved.
//
#import "SNViewController.h"
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@bryanbarnard
bryanbarnard / requests_get_incident_sn.py
Last active January 1, 2016 11:39
Sample Requests Python ServiceNow JSONv2 - GetIncident
##Sample HTTP Request to ServiceNow Demo Instance Using JSONv2 Web Service
import requests
from requests.auth import HTTPBasicAuth
#using local http proxy to log requests and responses
proxies = {
"http": "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888",
}
@bryanbarnard
bryanbarnard / requests_get_incidents.py
Last active December 5, 2019 11:28
Sample Requests Python ServiceNow JSONv2 - GetIncidents Get multiple Incidents using JSONv2 Web Service from ServiceNow using encoded query
import requests
from requests.auth import HTTPBasicAuth
#using local http proxy to log requests and responses
proxies = {
"http": "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888",
}
auth = HTTPBasicAuth("admin", "admin")
@bryanbarnard
bryanbarnard / requests_create_incident_sn.py
Last active July 22, 2022 18:20
Sample Requests Python ServiceNow JSONv2 - Create an Incident
import json
import requests
from requests.auth import HTTPBasicAuth
# using local http proxy to log requests and responses
proxies = {
"http": "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888",
}
@bryanbarnard
bryanbarnard / requests_update_incident_sn.py
Created January 2, 2014 16:40
Sample Requests Python ServiceNow JSONv2 - Update an Incident
import json
import requests
import datetime
from requests.auth import HTTPBasicAuth
# using local http proxy to log requests and responses
proxies = {
"http": "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888",
}
@bryanbarnard
bryanbarnard / node_request.js
Last active January 2, 2016 03:29
Node Make HTTP Request using proxy
//make use of proxy package to make calls
var request = require('request');
var r = request.defaults({'proxy':'http://127.0.0.1:8888'})
r('https://demo003.service-now.com/stats.do', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the body of the response
}
})
@bryanbarnard
bryanbarnard / 0_reuse_code.js
Created January 8, 2014 14:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bryanbarnard
bryanbarnard / SampleDirect_HTTP_Request
Created April 1, 2014 03:34
Sample HTTP Request - ServiceNow Direct Web Service - Incidents
POST https://demo006.service-now.com/incident.do?SOAP HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://www.service-now.com/incident/getRecords"
Content-Length: 326
Host: demo006.service-now.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: BIGipServerpool_demo006=808634890.33598.0000; JSESSIONID=4845EEC9C7ECAA69FBA52353A941BA52
Cookie2: $Version=1
@bryanbarnard
bryanbarnard / SampleDirect_HTTP_Response
Created April 1, 2014 03:45
SampleDirect_HTTP_Response
HTTP/1.1 200 OK
Set-Cookie: glide_user="";secure; Expires=Thu, 01-Jan-1970 00:00:10 GMT; HttpOnly
Set-Cookie: glide_user_session="";secure; Expires=Thu, 01-Jan-1970 00:00:10 GMT; HttpOnly
Set-Cookie: glide_user="U0N2Mjo5N2VhNTRiMTJmZjcxMTAwYjhjY2Y2N2I5MWExODk0Nzo2ODE2Zjc5Y2MwYTgwMTY0MDFjNWEzM2JlMDRiZTQ0MQ=="; Version=1; Max-Age=2147483647; Expires=Sun, 19-Apr-2082 06:32:21 GMT; HttpOnly
Set-Cookie: glide_user_session="U0N2Mjo5N2VhNTRiMTJmZjcxMTAwYjhjY2Y2N2I5MWExODk0Nzo2ODE2Zjc5Y2MwYTgwMTY0MDFjNWEzM2JlMDRiZTQ0MQ=="; Version=1; HttpOnly
Set-Cookie: glide_user_route=glide.a95da93e9baa2354958aa3c67bd1a027;secure; Expires=Sun, 19-Apr-2082 06:32:21 GMT; Path=/; HttpOnly
Pragma: no-store,no-cache
Cache-control: no-cache,no-store,must-revalidate,max-age=-1
Expires: 0
Content-Encoding: gzip