Static Public Member Functions | |
| static | createShortURL ($auth, $url, $params=array()) |
| static | updateShortURL ($auth, $url, $short_url, $params=array()) |
| static | getCellularCarrierId ($auth, $phone_list) |
| static | getCellularCarrier ($auth, $phone_list, $show_carrier_id=false) |
| static | authenticationTest ($auth) |
| static | getOrganizationTree ($auth) |
| static | test () |
| static authenticationTest | ( | $ | auth | ) | [static] |
Description:
| WSSimpleAuthentication | $auth | Simple Authentication Object username - String[40] (Required) - Username for company credentials password - String[40] (Required) - Password for company credentials api_key - String[40] (Required) - Credentials for company |
result - True/False, This will indicate whether the request was successful or not.
error_code - If there was an error in the request it will return an error number here.
message - Message stating if authentication was successful or not
<?php $wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl'; $soap = new SoapClient($wsdl); //create an authentication object $auth = array(); $auth['username'] = 'api_username'; $auth['password'] = 'api_password'; $auth['api_key'] = 'xxxxxxxxxxxxxx'; $results = $soap->authenticationTest($auth); print_r($results); if ($results->result == 0 || $results->error > 0) { //error processing throw new Exception($results->message); } else { //after success processing }
SOAP Request
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:webservices2_0_0">
<soapenv:Header/>
<soapenv:Body>
<urn:authenticationTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<auth xsi:type="urn:WSAuthentication">
<username xsi:type="xsd:string">api_username</username>
<password xsi:type="xsd:string">api_password</password>
<api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
</auth>
</urn:authenticationTest>
</soapenv:Body>
</soapenv:Envelope>
SOAP Response
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:webservices2_0_0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:authenticationTestResponse>
<authenticationTestReturn xsi:type="ns1:WSGenericResponse">
<message xsi:type="xsd:string">User [username] authenticated successfully.</message>
<response xsi:nil="true"/>
<result xsi:type="xsd:boolean">true</result>
</authenticationTestReturn>
</ns1:authenticationTestResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create web service authentication WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; //create task bind WS_TaskBinding bind = new WS_TaskBinding(); bind.Url = "SSL//HOST_URL/webservices/task/2.0.0"; //create result object WSGenericResponse ws_result = new WSGenericResponse(); //call bind event ws_result = bind.authenticationTest(auth); //check to see if there was an error if (!ws_result.result) { //handle error label.Text = ws_result.message; } else { //handle successful response label.Text = ws_result.message; }
| static createShortURL | ( | $ | auth, |
| $ | url, | ||
| $ | params = array() |
||
| ) | [static] |
| WSAuthentication | $auth | |
| string | $url | |
| WSCustomField[] | $params |
| static getCellularCarrier | ( | $ | auth, |
| $ | phone_list, | ||
| $ | show_carrier_id = false |
||
| ) | [static] |
Description:
| WSSimpleAuthentication | $auth | Simple Authentication Object username - String[40] (Required) - Username for company credentials password - String[40] (Required) - Password for company credentials api_key - String[40] (Required) - Credentials for company code - Integer (Required) - Default shortcode or longcode for keyword keyword - String[40] (Required) - Default keyword for the group, division or company |
| string | $phone_list | Phone List phone_list - String (Required) - Comma seperated list of phone numbers to be checked (with country code) |
result - True/False, This will indicate whether the request was successful or not.
error_code - If there was an error in the request it will return an error number here.
carrier - Carrier of the cellular phone number
international - True = It is an international number, False = It is not international
landline - True = It is a landline number, False = It is not a landline
phone - The phone number that was checked
Code Examples:
<?php $wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl'; $soap = new SoapClient($wsdl); //create an authentication object $auth = array(); $auth['username'] = 'api_username'; $auth['password'] = 'api_password'; $auth['api_key'] = 'xxxxxxxxxxxxxx'; //set phone number (could be a comma seperated list, max of 100) $phone = '18885554433'; $results = $soap->getCellularCarrier($auth, $phone); print_r($results); if ($results->result == 0 || $results->error > 0) { //error processing throw new Exception($results->message); } else { //after success processing }
SOAP Request <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:webservices2_0_0"> <soapenv:Header/> <soapenv:Body> <urn:getCellularCarrier soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <auth xsi:type="urn:WSSimpleAuthentication"> <!--You may enter the following 3 items in any order--> <api_key xsi:type="xsd:string">${api_key}</api_key> <password xsi:type="xsd:string">${password}</password> <username xsi:type="xsd:string">${username}</username> </auth> <phone xsi:type="xsd:string">18885554433</phone> </urn:getCellularCarrier> </soapenv:Body> </soapenv:Envelope> SOAP Response <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:webservices2_0_0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:getCellularCarrierResponse> <getCellularCarrierReturn xsi:type="ns1:WSCarrierPhoneResponse"> <error_code xsi:type="xsd:int">0</error_code> <message xsi:type="xsd:string">Successfully found carrier.</message> <response xsi:type="ns1:WSCarrierPhoneList"> <list SOAP-ENC:arrayType="ns1:WSCarrierPhoneRow[1]" xsi:type="ns1:WSCarrierPhoneRowArray"> <item xsi:type="ns1:WSCarrierPhoneRow"> <carrier xsi:type="xsd:string">Wireless Carrier</carrier> <international xsi:type="xsd:boolean">false</international> <invalid xsi:type="xsd:boolean">false</invalid> <landline xsi:type="xsd:boolean">false</landline> <phone xsi:type="xsd:string">18885554433</phone> </item> </list> </response> <result xsi:type="xsd:boolean">true</result> </getCellularCarrierReturn> </ns1:getCellularCarrierResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
//Get Cellular Carrier Example WS_TaskBinding bind = new WS_TaskBinding(); bind.Url = "SSL//HOST_URL/webservices/task/2.0.0"; WSSimpleAuthentication auth = new WSSimpleAuthentication(); auth.api_key = "xxxxxxxxxxxxxx"; auth.username = "api_username"; auth.password = "api_password"; string phone = "18885554433"; WSCarrierPhoneResponse response = bind.getCellularCarrier(auth, phone); if (response.result == true) { //loop through the list and process the response for each number. WSCarrierPhoneList list = response.response; } else { //do error handling }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=task.getCellularCarrier&username={username}&password={password}&api_key={api_key}&phone=18885554433,18885554422 Response <?xml version="1.0" encoding="utf-8"?> <getCellularCarrier> <message>Successfully found carrier.</message> <error_code></error_code> <result>true</result> <response> <list> <item> <carrier>cingular</carrier> <phone>18885554433</phone> <landline>false</landline> <invalid>false</invalid> <international>false</international> </item> <item> <carrier>Verizon Wireless</carrier> <phone>18885554422</phone> <landline>false</landline> <invalid>false</invalid> <international>false</international> </item> </list> </response> </getCellularCarrier>
| static getCellularCarrierId | ( | $ | auth, |
| $ | phone_list | ||
| ) | [static] |
Description:
| WSSimpleAuthentication | $auth | Simple Authentication Object username - String[40] (Required) - Username for company credentials password - String[40] (Required) - Password for company credentials api_key - String[40] (Required) - Credentials for company |
| string | $phone_list | Phone List phone_list - String (Required) - Comma seperated list of phone numbers to be checked (with country code) |
result - True/False, This will indicate whether the request was successful or not. error_code - If there was an error in the request it will return an error number here. carrier - Carrier of the cellular phone number carrier_id - Carrier ID of the cellular phone number international - True = It is an international number, False = It is not international landline - True = It is a landline number, False = It is not a landline phone - The phone number that was checked
Code Examples:
<?php $wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl'; $soap = new SoapClient($wsdl); //create an authentication object $auth = array(); $auth['username'] = 'api_username'; $auth['password'] = 'api_password'; $auth['api_key'] = 'xxxxxxxxxxxxxx'; //set phone number (could be a comma seperated list, max of 100) $phone = '18885554433'; $results = $soap->getCellularCarrierId($auth, $phone); print_r($results); if ($results->result == 0 || $results->error > 0) { //error processing throw new Exception($results->message); } else { //after success processing }
SOAP Request <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:webservices2_0_0"> <soapenv:Header/> <soapenv:Body> <urn:getCellularCarrierId soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <auth xsi:type="urn:WSSimpleAuthentication"> <!--You may enter the following 3 items in any order--> <api_key xsi:type="xsd:string">${api_key}</api_key> <password xsi:type="xsd:string">${password}</password> <username xsi:type="xsd:string">${username}</username> </auth> <phone xsi:type="xsd:string">18885554433</phone> </urn:getCellularCarrierId> </soapenv:Body> </soapenv:Envelope> SOAP Response <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:webservices2_0_0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:getCellularCarrierIdResponse> <getCellularCarrierIdReturn xsi:type="ns1:WSCarrierPhoneResponse"> <error_code xsi:type="xsd:int">0</error_code> <message xsi:type="xsd:string">Successfully found carrier.</message> <response xsi:type="ns1:WSCarrierPhoneList"> <list SOAP-ENC:arrayType="ns1:WSCarrierPhoneRow[1]" xsi:type="ns1:WSCarrierPhoneRowArray"> <item xsi:type="ns1:WSCarrierPhoneRow"> <carrier xsi:type="xsd:string">Wireless Carrier</carrier> <carrier_id xsi:type="xsd:string">Wireless Carrier ID</carrier_id> <international xsi:type="xsd:boolean">false</international> <invalid xsi:type="xsd:boolean">false</invalid> <landline xsi:type="xsd:boolean">false</landline> <phone xsi:type="xsd:string">18885554433</phone> </item> </list> </response> <result xsi:type="xsd:boolean">true</result> </getCellularCarrierIdReturn> </ns1:getCellularCarrierIdResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
//Get Cellular CarrierId Example WS_TaskBinding bind = new WS_TaskBinding(); bind.Url = "SSL//HOST_URL/webservices/task/2.0.0"; WSSimpleAuthentication auth = new WSSimpleAuthentication(); auth.api_key = "xxxxxxxxxxxxxx"; auth.username = "api_username"; auth.password = "api_password"; string phone = "18885554433"; WSCarrierPhoneResponse response = bind.getCellularCarrierId(auth, phone); if (response.result == true) { //loop through the list and process the response for each number. WSCarrierPhoneList list = response.response; } else { //do error handling }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=task.getCellularCarrierId&username={username}&password={password}&api_key={api_key}&phone=18885554433,18885554422 Response <?xml version="1.0" encoding="utf-8"?> <getCellularCarrierId> <message>Successfully found carrier.</message> <error_code></error_code> <result>true</result> <response> <list> <item> <carrier>cingular</carrier> <phone>18885554433</phone> <landline>false</landline> <invalid>false</invalid> <international>false</international> </item> <item> <carrier>Verizon Wireless</carrier> <phone>18885554422</phone> <landline>false</landline> <invalid>false</invalid> <international>false</international> </item> </list> </response> </getCellularCarrierId>
| static getOrganizationTree | ( | $ | auth | ) | [static] |
Description:
| WSAuthentication | $auth | Authentication Object username - String[40] (Required) - Username for company credentials password - String[40] (Required) - Password for company credentials api_key - String[40] (Required) - Credentials for company code - Integer (Required) - Default shortcode or longcode for keyword keyword - String[40] (Required) - Default keyword for the group, division or company |
result - True/False, This will indicate whether the request was successful or not.
error_code - If there was an error in the request it will return an error number here.
response - This will list out the organization based on the keyword passed in the auth object.
<?php $wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl'; $soap = new SoapClient($wsdl); //create an authentication object $auth = array( "username" => 'api_username', "password" => 'api_password', "api_key" => 'api_key', "code" => '12345', "keyword" => 'Keyword', ); $results = $soap->getOrganizationTree($auth); print_r($results); if ($results->result == 0 || $results->error > 0) { //error processing throw new Exception($results->message); } else { //after success processing }
SOAP Request <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:webservices2_0_0"> <soapenv:Header/> <soapenv:Body> <urn:getOrganizationTree soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <auth xsi:type="urn:WSAuthentication"> <!--You may enter the following 5 items in any order--> <api_key xsi:type="xsd:string">api_key</api_key> <code xsi:type="xsd:string">12345</code> <keyword xsi:type="xsd:string">company or division keyword</keyword> <password xsi:type="xsd:string">api_password</password> <username xsi:type="xsd:string">api_username</username> </auth> </urn:getOrganizationTree> </soapenv:Body> </soapenv:Envelope> SOAP Response <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:webservices2_0_0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:getOrganizationTreeResponse> <getOrganizationTreeReturn xsi:type="ns1:WSDivisionResponse"> <error_code xsi:type="xsd:int">0</error_code> <message xsi:type="xsd:string">Successfully loaded organization tree.</message> <response xsi:type="ns1:WSDivision"> <address xsi:type="ns1:WSAddress"> <city xsi:nil="true"/> <state xsi:nil="true"/> <state_abbr xsi:nil="true"/> <street xsi:nil="true"/> <street2 xsi:nil="true"/> <zip xsi:nil="true"/> </address> <default_code xsi:type="xsd:string"/> <divisions SOAP-ENC:arrayType="ns1:WSDivision[3]" xsi:type="ns1:WSDivisionArray"> <item xsi:type="ns1:WSDivision"> <address xsi:type="ns1:WSAddress"> <city xsi:nil="true"/> <state xsi:nil="true"/> <state_abbr xsi:nil="true"/> <street xsi:nil="true"/> <street2 xsi:nil="true"/> <zip xsi:nil="true"/> </address> <default_code xsi:type="xsd:string"/> <divisions SOAP-ENC:arrayType="ns1:WSDivision[0]" xsi:type="ns1:WSDivisionArray"/> <email xsi:type="xsd:string"/> <keyword xsi:type="xsd:string">58228</keyword> <name xsi:type="xsd:string">Division</name> <phone xsi:type="xsd:string"/> <subscriptionnodes SOAP-ENC:arrayType="ns1:WSSubscriptionnode[2]" xsi:type="ns1:WSSubscriptionnodeArray"> <item xsi:type="ns1:WSSubscriptionnode"> <default_code xsi:type="xsd:string"/> <ispublic xsi:nil="true"/> <keywords SOAP-ENC:arrayType="ns1:WSKeyword[3]" xsi:type="ns1:WSKeywordArray"> <item xsi:type="ns1:WSKeyword"> <app_identifier xsi:type="xsd:string"></app_identifier> <auto_subscribe xsi:type="xsd:int">1</auto_subscribe> <callback_url xsi:type="xsd:string">http://callback/log</callback_url> <keyword_type xsi:type="xsd:int">1</keyword_type> <note xsi:nil="true"/> <response xsi:type="xsd:string"/> <subscribed_response xsi:type="xsd:string"/> <word xsi:type="xsd:string">58229</word> </item> <item xsi:type="ns1:WSKeyword"> <app_identifier xsi:nil="true"/> <auto_subscribe xsi:type="xsd:int">1</auto_subscribe> <callback_url xsi:type="xsd:string"/> <keyword_type xsi:type="xsd:int">5</keyword_type> <note xsi:type="xsd:string"/> <response xsi:type="xsd:string">Welcome to Division!</response> <subscribed_response xsi:type="xsd:string">Already subscribed to Division!</subscribed_response> <word xsi:type="xsd:string">Created Keyword</word> </item> <stackOrder xsi:type="xsd:int">0</stackOrder> </item> </subscriptionnodes> <url xsi:type="xsd:string"/> </item> </response> <result xsi:type="xsd:boolean">true</result> </getOrganizationTreeReturn> </ns1:getOrganizationTreeResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
WS_TaskBinding bind = new WS_TaskBinding(); bind.Url = "SSL//HOST_URL/webservices/task/2.0.0"; WSAuthentication auth = new WSAuthentication(); auth.api_key = "api_key"; auth.username = "api_username"; auth.password = "api_password"; auth.keyword = "keyword"; auth.code = "12345"; WSDivisionResponse response = bind.getOrganizationTree(auth); if (response.result == true) { //process division (and included sub-divisions/groups) WSDivision division = response.response; } else { //do error handling }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=task.getOrganizationTree&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company Keyword} Response <?xml version="1.0" encoding="utf-8"?> <getOrganizationTree> <message>Successfully loaded organization tree.</message> <error_code></error_code> <result>true</result> <response> <name>Company</name> <address> <street></street> <street2></street2> <city></city> <state></state> <state_abbr></state_abbr> <zip></zip> </address> <phone></phone> <email></email> <url></url> <keyword>31191</keyword> <default_code></default_code> <divisions> <item> <name>Division 1</name> <address> <street></street> <street2></street2> <city></city> <state></state> <state_abbr></state_abbr> <zip></zip> </address> <phone>5551234567</phone> <email>email@test.com</email> <url></url> <keyword>31193</keyword> <default_code>91011</default_code> <divisions></divisions> <subscriptionnodes> <item> <name>Group 1</name> <ispublic>1</ispublic> <keywords> <item> <word>Keyword</word> <note></note> <response></response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>6</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </item> <item> <word>31194(Default Keyword)</word> <note></note> <response></response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>1</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </item> </keywords> <stackOrder></stackOrder> <default_code>12345</default_code> </item> <item> <name>Group 2</name> <ispublic>1</ispublic> <keywords> <item> <word>31323</word> <note></note> <response></response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>1</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </item> </keywords> <stackOrder></stackOrder> <default_code>12345</default_code> </item> </subscriptionnodes> </item> <item> <name>Division 2</name> <address> <street></street> <street2></street2> <city></city> <state></state> <state_abbr></state_abbr> <zip></zip> </address> <phone></phone> <email></email> <url></url> <keyword>31208</keyword> <default_code>12345</default_code> <divisions></divisions> <subscriptionnodes> <item> <name>Group 1</name> <ispublic>1</ispublic> <keywords> <item> <word>Keyword</word> <note></note> <response></response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>5</keyword_type> <app_identifier></app_identifier> <active>0</active> <fields></fields> </item> <item> <word>31210</word> <note></note> <response></response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>1</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </item> </keywords> <stackOrder></stackOrder> <default_code>91011</default_code> </item> </subscriptionnodes> </item> </divisions> <subscriptionnodes></subscriptionnodes> </response> </getOrganizationTree>
| static test | ( | ) | [static] |
A simple test to verify the web services are working.
| static updateShortURL | ( | $ | auth, |
| $ | url, | ||
| $ | short_url, | ||
| $ | params = array() |
||
| ) | [static] |
| WSAuthentication | $auth | |
| string | $url | |
| string | $short_url | |
| WSCustomField[] | $params |