This file contains hidden or 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
| def addBatch(instance, sessionId, jobId, objects): | |
| request = u"""<?xml version="1.0" encoding="UTF-8"?> | |
| <sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload"> | |
| """ + objects + """ | |
| </sObjects>""" | |
| encoded_request = request.encode('utf-8') | |
| url = "https://" + instance + ".salesforce.com/services/async/30.0/job/" + jobId + "/batch" | |
This file contains hidden or 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
| import requests | |
| import xml.etree.ElementTree as ET | |
| def login(userName, password): | |
| request = u"""<?xml version="1.0" encoding="utf-8" ?> | |
| <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> | |
| <env:Body> |
This file contains hidden or 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
| private async void MainPage_Loaded(object sender, RoutedEventArgs e) | |
| { | |
| await GetAccessToken(); | |
| // navigate to AccountsPage.xaml | |
| this.Frame.Navigate(typeof (AccountsPage)); | |
| } |
This file contains hidden or 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
| namespace ConsoleApplication | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var task = RunProgram(); | |
| task.Wait(); | |
| } |
This file contains hidden or 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
| private static async Task<string> Create(string query, string sessionId, string metadataServerUrl) | |
| { | |
| var wsdlNamespace = "http://soap.sforce.com/2006/04/metadata"; | |
| var header = ""; | |
| var action = "create"; | |
| var soap = string.Format( | |
| @"<soapenv:Envelope xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" | |
| xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" | |
| xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" |
This file contains hidden or 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
| POST https://na15.salesforce.com/services/Soap/m/29.0/00Di0000000icUB HTTP/1.1 | |
| SOAPAction: create | |
| Content-Type: text/xml; charset=utf-8 | |
| Host: na15.salesforce.com | |
| Content-Length: 894 | |
| Expect: 100-continue | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apex="http://soap.sforce.com/2006/08/apex" xmlns:cmd="http://soap.sforce.com/2006/04/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <soapenv:Header> |
This file contains hidden or 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
| static async Task<T> Login<T>(string userName, string password, string orgId) | |
| { | |
| string url; | |
| string soap; | |
| string wsdlType; | |
| if (typeof(T) == typeof(Enterprise.LoginResult)) | |
| { | |
| url = "https://login.salesforce.com/services/Soap/c/29.0/" + orgId; | |
| soap = string.Format(@"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><login xmlns=""urn:enterprise.soap.sforce.com""><username>{0}</username><password>{1}</password></login></s:Body></s:Envelope>", userName, password); |
This file contains hidden or 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
| import pika, os, urlparse, sys | |
| from Adafruit_Thermal import * | |
| printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5) | |
| url_str = os.environ.get('CLOUDAMQP_URL','amqp://YOUR_CLOUDAMQP_URL') | |
| url = urlparse.urlparse(url_str) | |
| params = pika.ConnectionParameters(host=url.hostname, virtual_host=url.path[1:], | |
| credentials=pika.PlainCredentials(url.username, url.password)) |
This file contains hidden or 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
| private async void btnExpireToken_Click(object sender, RoutedEventArgs e) | |
| { | |
| _token.AccessToken = "GARBAGE"; | |
| var response = await RetryMethod<dynamic>(GetAccounts, 3, 0, RefreshToken); | |
| } | |
| private async Task RefreshToken() | |
| { | |
| var auth = new AuthenticationClient(); |