Affiliate Import Instructions 2012 Technical information for posting leads into the Leads2Trade system. Please use the following web service address for importing the leads data. http://affiliate.trustedlocalsuppliers.org/services/dataservice.asmx You can view the import definitions and supported protocols here – http://affiliate.trustedlocalsuppliers.org/services/dataservice.asmx?op=ImportData Or http://affiliate.trustedlocalsuppliers.org/services/dataservice.asmx?op=ImportDataLeadID Please see example at the end of this document for full details, Please ensure you set the correct new username and password to post into our system, the following is the credentials node, simply replace yourcompany and the username and password values with the details given in the email containing this document Here are some FAQs regarding the usage of the service: 1) Is there a demo/test account that could be used during testing? You can use the data outlined in the import sample, however the only requirement to mark lead submissions as a test is to use the XX prefix for the postcode value – eg: XX12 1RG 2) What is the product name value for the service? The supported products in the system must be named as follows (capitalization has no effect): Doors Rooflines Windows Fitted Kitchens Conservatories Wooden Windows and Doors Double Glazing Appointment Booking Grant Application Supply Only – Windows Supply Only – Doors Supply Only - Conservatories Aluminium Conservatories Wooden Connie Aluminium Windows Repairs Brochure Requests Supply Only - Kitchens Holidays Conservatory Roofs Insulation Solar PV Solar Hotwater Ground source Air Source Flat Roofs Supply Only - Wooden Windows Supply Only - Aluminium Windows Solar Supply Only Supply Only – Wooden Conservatories Supply Only – Aluminium Conservatories Free PV Commercial PV Boiler 3) What are your mandatory fields? The following fields are mandatory: name, email, postcode, tel 4) Does the system return any values to indicate accept/fail of records so we can update the system here? The response should be received in the following format : If there are no failed imports the following would be sent back for ImportData method 1 If there are no failed imports the following would be sent back for ImportDataLeadID method 2 213456 213452 < LeadIDs > If there are some imports that did fail the following would be sent back for example 2 records sent 1 213456 < LeadIDs > Lead Import Failed – Invalid postcode If a single lead is sent and fails the LeadIDs section will be missing. If there is an issue with the XML you should get a response as follows : 0 The ‘ notes’ start tag on line Sample Import XML Import Test import_test@testing.com XX1 1TT 13
Test
Test Test 01234567890 01234567890 Test Notes
Import Tester import_tester@testing.com XX1 1TT 13
Test
Test Test 01234567890 01234567890 Test Notes
Import Testing import_testing@testing.com XX1 1TT 13
Test
Test Test 01234567890 01234567890 Test Notes
Sample .NET Code (c#) using System.Net; using System.IO; public void UseWebService() { string xmldata; string uri = "http://affiliate.trustedlocalsuppliers.org/services/dataservice.asmx/ImportData"; xmldata = "Test Onlya@b.comxCB5 8AG
07967 486099 interested in :UPVC Double Glazing
"; string htmldata = ""; htmldata = "xmlData=" + xmldata; const int bufSizeMax = 65536; // max read buffer size conserves memory const int bufSizeMin = 8192; // min size prevents numerous small reads StringBuilder sb = new StringBuilder(""); // A WebException is thrown if HTTP request fails try { // Create an HttpWebRequest using WebRequest.Create (see .NET docs)! HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); if (xmldata != "") { request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; string parameters = htmldata; byte[] bytes = UTF8Encoding.ASCII.GetBytes(parameters); Stream os = null; try { request.ContentLength = bytes.Length; os = request.GetRequestStream(); os.Write(bytes, 0, bytes.Length); } catch (Exception ex) { //Codeerror("HTML Post : " + ex.Message); } finally { os.Close(); } try { // Execute the request and obtain the response stream HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); // Content-Length header is not trustable, but makes a good hint. // Responses longer than int size will throw an exception here! int length = (int)response.ContentLength; // Use Content-Length if between bufSizeMax and bufSizeMin int bufSize = bufSizeMin; if (length > bufSize) bufSize = length > bufSizeMax ? bufSizeMax : length; // Allocate buffer and StringBuilder for reading response byte[] buf = new byte[bufSize]; sb = new StringBuilder(bufSize); // Read response stream until end while ((length = responseStream.Read(buf, 0, buf.Length)) != 0) sb.Append(Encoding.UTF8.GetString(buf, 0, length)); MessageBox.Show(sb.ToString()); } catch (Exception ex) { sb = new StringBuilder("HTML Response : " + ex.Message); } } } catch (Exception ex) { sb = new StringBuilder(ex.Message); // Codeerror("HTML Post : " + ex.Message); } MessageBox.Show(sb.ToString()); } NOTE : This may reply as duplicate … you may need to change details.