Static Public Member Functions | |
| static | createKeyword ($auth, $new_keyword) |
| static | deleteKeyword ($auth) |
| static | keywordExists ($auth, $keyword) |
| static | readKeyword ($auth) |
| static | updateKeyword ($auth, $keyword) |
| static createKeyword | ( | $ | auth, |
| $ | new_keyword | ||
| ) | [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 keyword - String[40] (Required) - Default keyword for group to which the keyword will be associated with. |
| WSKeyword | $new_keyword | New_keyword Object app_identifier - String (Not Used) - This is used for internal purposes only auto_subscribe - Integer (Optional) - 1 = automatically subsribe to group 0 = do not subscribe callback_url - String (Optional) - Callback URL keyword_type - Integer (Required) - 1 = Subscription (Internal use only) 4 = Division (Internal use only) 5 = Custom 6 = mCard note - String (Optional) - Miscellaneous notes entered here response - String (Optional) - Message to be sent to subscriber subscribed_response - String (Optional) - Message sent to subscriber if they try and opt in a second time word - String (Required) - Desired word to be added as the keyword WSCustomField - Object (Optional For mCard use only) - This is the object used to set mCard fields through the API name - String (Required) - title, company_name, website, first_name, last_name, office, mobile, email, address, city, state, zip, linkedin, blog, facebook, twitter value - String (Required) - Any value to be paired with the above designated fields. |
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. auto_subscribe - Integer (Optional) - 1 = automatically subsribe to group 0 = do not subscribe callback_url - Returns callback_url if one is set fields - Any mCard fields that are set note - Any notes set will be returned response - Response that is set for the keyword subscribed_response - Response set for already subscribed message word - Keyword name
Coded 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'; $auth['keyword'] = 'group_keyword'; $auth['code'] = 12345; //create customField object for mCard creation to pass in the keyword object $mCardFields = array(); $mCardFields[] = array('name'=>'title','value'=>'Mr.'); $mCardFields[] = array('name'=>'company_name','value'=>'Test'); $mCardFields[] = array('name'=>'website','value'=>'www.test.com'); $mCardFields[] = array('name'=>'first_name','value'=>'Test'); $mCardFields[] = array('name'=>'last_name','value'=>'Testers'); $mCardFields[] = array('name'=>'office','value'=>'888 555 4433'); $mCardFields[] = array('name'=>'mobile','value'=>'888 555 4422'); $mCardFields[] = array('name'=>'email','value'=>'test@test.com'); $mCardFields[] = array('name'=>'address','value'=>'123 Main 234 East'); $mCardFields[] = array('name'=>'city','value'=>'Cityville'); $mCardFields[] = array('name'=>'state','value'=>'ID'); $mCardFields[] = array('name'=>'zip','value'=>'83401'); $mCardFields[] = array('name'=>'linkedin','value'=>'www.linkedin.com/test'); $mCardFields[] = array('name'=>'blog','value'=>'test.blogspot.com'); $mCardFields[] = array('name'=>'facebook','value'=>'www.facebook.com/test'); $mCardFields[] = array('name'=>'twitter','value'=>'www.twitter.com/test'); //create a keyword object $kw = array(); $kw['word'] = 'new_kw1'; $kw['response'] = 'Response'; $kw['auto_subscribe'] = 1; $kw['subscribed_response'] = 'Subscribed response.'; $kw['keyword_type'] = 6; $kw['app_identifier'] = ''; $kw['callback_url'] = ''; $kw['note'] = ''; $kw['active'] = 1; $kw['fields'] = $mCardFields; $results = $soap->createKeyword($auth, $kw, $mCardFields); 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:createKeyword 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>
<code xsi:type="xsd:string">12345</code>
<keyword xsi:type="xsd:string">parent_group_keyword</keyword>
</auth>
<new_keyword xsi:type="urn:WSKeyword">
<auto_subscribe xsi:type="xsd:integer">1</auto_subscribe>
<callback_url xsi:type="xsd:string">http://www.test.com/callback</callback_url>
<note xsi:type="xsd:string">Keyword note</note>
<response xsi:type="xsd:string">Auto Response</response>
<send_account_details xsi:type="xsd:integer">1</send_account_details>
<subscribed_response xsi:type="xsd:string">Already subscribed response</subscribed_response>
<word xsi:type="xsd:string">testkw1</word>
<fields xsi:type="urn:WSCustomFieldArray" soapenc:arrayType="urn:WSCustomField[]">
<field>
<name>title</name>
<value>Mr.</value>
</field>
<field>
<name>company_name</name>
<value>TestCompany</value>
</field>
<field>
<name>website</name>
<value>www.test.com</value>
</field>
<field>
<name>first_name</name>
<value>Test</value>
</field>
<field>
<name>last_name</name>
<value>Tester</value>
</field>
<field>
<name>office</name>
<value>18885554433</value>
</field>
<field>
<name>mobile</name>
<value>18885554422</value>
</field>
<field>
<name>email</name>
<value>test@test.com</value>
</field>
<field>
<name>address</name>
<value>123 East 234 Main</value>
</field>
<field>
<name>city</name>
<value>Cityville</value>
</field>
<field>
<name>state</name>
<value>ID</value>
</field>
<field>
<name>zip</name>
<value>83401</value>
</field>
<field>
<name>linkedin</name>
<value>http://www.linkedin.com/pub/test</value>
</field>
<field>
<name>blog</name>
<value>www.test.blogspot.com</value>
</field>
<field>
<name>facebook</name>
<value>www.facebook.com/profile</value>
</field>
<field>
<name>twitter</name>
<value>https://twitter.com/#!/test</value>
</field>
</fields>
</new_keyword>
</urn:createKeyword>
</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:createKeywordResponse>
<createKeywordReturn xsi:type="ns1:WSKeywordResponse">
<message xsi:type="xsd:string">Successfully created keyword.</message>
<response xsi:type="ns1:WSKeyword">
<auto_subscribe xsi:type="xsd:int">1</auto_subscribe>
<callback_url xsi:type="xsd:string">http://www.test.com/callback</callback_url>
<fields SOAP-ENC:arrayType="ns1:WSCustomField[1]" xsi:type="ns1:WSCustomFieldArray">
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">title</name>
<value xsi:type="xsd:string">Mr.</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">company_name</name>
<value xsi:type="xsd:string">TestCompany</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">website</name>
<value xsi:type="xsd:string">www.test.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">first_name</name>
<value xsi:type="xsd:string">Test</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">last_name</name>
<value xsi:type="xsd:string">Tester</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">office</name>
<value xsi:type="xsd:string">18885554433</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">mobile</name>
<value xsi:type="xsd:string">18885554422</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">email</name>
<value xsi:type="xsd:string">test@test.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">address</name>
<value xsi:type="xsd:string">123 East 234 Main</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">city</name>
<value xsi:type="xsd:string">Cityville</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">state</name>
<value xsi:type="xsd:string">Idaho</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">zip</name>
<value xsi:type="xsd:string">83401</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">linkedin</name>
<value xsi:type="xsd:string">http://www.linkedin.com/pub/test</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">blog</name>
<value xsi:type="xsd:string">www.test.blogspot.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">facebook</name>
<value xsi:type="xsd:string">www.facebook.com/profile</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">twitter</name>
<value xsi:type="xsd:string">https://twitter.com/#!/test</value>
</item>
</fields>
<note xsi:type="xsd:string">Keyword note</note>
<response xsi:type="xsd:string">Auto Response</response>
<send_account_details xsi:type="xsd:int">1</send_account_details>
<subscribed_response xsi:type="xsd:string">Already subscribed response</subscribed_response>
<word xsi:type="xsd:string">testkw1</word>
</response>
<result xsi:type="xsd:boolean">true</result>
</createKeywordReturn>
</ns1:createKeywordResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create task bind WS_KeywordBinding bind = new WS_KeywordBinding(); bind.Url = "SSL//HOST_URL/webservices/keyword/2.0.0"; //create web service authentication WSAuthentication auth = new WSAuthentication(); auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.keyword = "group_keyword"; auth.code = "12345"; List<WSCustomField> fields = new List<WSCustomField>(); //create customField object for mCard creation THIS IS ONLY TO BE USED IF YOU ARE CREATING AN MCARD KEYWORD, DISREGARD THIS IF YOU ARE CREATING WSCustomField field = new WSCustomField(); field.name = "title"; field.value = "Mr."; fields.Add(field); field = new WSCustomField(); field.name = "company_name"; field.value = "test"; fields.Add(field); field = new WSCustomField(); field.name = "website"; field.value = "www.test.com"; fields.Add(field); field = new WSCustomField(); field.name = "first_name"; field.value = "Test"; fields.Add(field); field = new WSCustomField(); field.name = "last_name"; field.value = "Tester"; fields.Add(field); field = new WSCustomField(); field.name = "office"; field.value = "18885554433"; fields.Add(field); field = new WSCustomField(); field.name = "mobile"; field.value = "18885554422"; fields.Add(field); field = new WSCustomField(); field.name = "email"; field.value = "test@test.com"; fields.Add(field); field = new WSCustomField(); field.name = "address"; field.value = "123 East 234 Main"; fields.Add(field); field = new WSCustomField(); field.name = "city"; field.value = "Cityville"; fields.Add(field); field = new WSCustomField(); field.name = "state"; field.value = "ID"; fields.Add(field); field = new WSCustomField(); field.name = "zip"; field.value = "83401"; fields.Add(field); field = new WSCustomField(); field.name = "linkedin"; field.value = "www.linkedin.com/test"; fields.Add(field); field = new WSCustomField(); field.name = "blog"; field.value = "www.test.blogspot.com"; fields.Add(field); field = new WSCustomField(); field.name = "facebook"; field.value = "www.facebook.com/test"; fields.Add(field); field = new WSCustomField(); field.name = "twitter"; field.value = "www.twitter.com/test"; fields.Add(field); //create keyword object WSKeyword kw = new WSKeyword(); kw.auto_subscribe = 1; kw.callback_url = "SSL//www.test.com/callback"; kw.note = "Keyword note"; kw.response = "Auto Response"; kw.send_account_details = 1; kw.subscribed_response = "Already subscribed response"; kw.word = "testkw1"; kw.active = true; kw.keyword_type = 6; kw.fields = fields.ToArray(); //create result object WSKeywordResponse ws_result = new WSKeywordResponse(); //call bind event ws_result = bind.createKeyword(auth,kw); //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; WSKeyword keyword = ws_result.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=keyword.createKeyword&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Group Keyword}&word=Keyword Name&auto_subscribe=0&keyword_type=5&response=Thanks for subscribing Response <?xml version="1.0" encoding="utf-8"?> <createKeyword> <message>Successfully created keyword.</message> <error_code></error_code> <result>true</result> <response> <word>Keyword Name</word> <note></note> <response>Thanks for subscribing</response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe></auto_subscribe> <keyword_type>5</keyword_type> <app_identifier></app_identifier> <active></active> <fields></fields> </response> </createKeyword>
| static deleteKeyword | ( | $ | 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 keyword - String[40] (Required) - Keyword to be deleted |
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 - Successful or unsuccessful deletion of keyword
<?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'; $auth['keyword'] = 'keyword_to_delete'; $auth['code'] = 12345; $results = $soap->deleteKeyword($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:deleteKeyword 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>
<code xsi:type="xsd:string">12345</code>
<keyword xsi:type="xsd:string">custom_keyword_to_delete</keyword>
</auth>
</urn:deleteKeyword>
</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:deleteKeywordResponse>
<deleteKeywordReturn xsi:type="ns1:WSKeywordResponse">
<message xsi:type="xsd:string">Successfully deleted keyword.</message>
<response xsi:nil="true" xsi:type="ns1:WSKeyword"/>
<result xsi:type="xsd:boolean">true</result>
</deleteKeywordReturn>
</ns1:deleteKeywordResponse>
</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"; auth.keyword = "keyword_to_delete"; auth.code = "12345"; //create task bind WS_KeywordBinding bind = new WS_KeywordBinding(); bind.Url = "SSL//HOST_URL/webservices/keyword/2.0.0"; //create result object WSKeywordResponse ws_result = new WSKeywordResponse(); //call bind event ws_result = bind.deleteKeyword(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; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=keyword.deleteKeyword&username={username}&password={password}&api_key={api_key}&code=12345&keyword=Word Response <?xml version="1.0" encoding="utf-8"?> <deleteKeyword> <message>Successfully deleted keyword.</message> <error_code></error_code> <result>true</result> <response></response> </deleteKeyword>
| static keywordExists | ( | $ | auth, |
| $ | keyword | ||
| ) | [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 keyword - String[40] (Required) - Default keyword |
| WSKeyword | $keyword | Keyword Object word - String (Required) - Word to check to see if exists |
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 - Keyword exists/Keyword does not exist
<?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'; $auth['code'] = 12345; $keyword = array(); $keyword['word'] = 'keyword_to_check'; $keyword['active'] = 1; $keyword['app_identifier'] = ''; $keyword['auto_subscribe'] = 1; $keyword['callback_url'] = ''; $keyword['fields'] = ''; $keyword['keyword_type'] = 5; $keyword['note'] = ''; $keyword['response'] = 'Thanks for subscribing'; $keyword['subscribed_response'] = 'Already Subscribed'; $results = $soap->keywordExists($auth, $keyword); 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:keywordExists 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>
<code xsi:type="xsd:string">12345</code>
</auth>
<keyword xsi:type="urn:WSKeyword">
<word xsi:type="xsd:string">keyword_word_check</word>
</keyword>
</urn:keywordExists>
</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:keywordExistsResponse>
<keywordExistsReturn xsi:type="ns1:WSKeywordExistsResponse">
<message xsi:type="xsd:string">Keyword does not exist.</message>
<response xsi:type="xsd:boolean">false</response>
<result xsi:type="xsd:boolean">true</result>
</keywordExistsReturn>
</ns1:keywordExistsResponse>
</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"; auth.code = "12345"; //create keyword to check WSKeyword kw = new WSKeyword(); kw.word = "keyword_word_to_check"; //create task bind WS_KeywordBinding bind = new WS_KeywordBinding(); bind.Url = "SSL//HOST_URL/webservices/keyword/2.0.0"; //create result object WSKeywordExistsResponse ws_result = new WSKeywordExistsResponse(); //call bind event ws_result = bind.keywordExists(auth,kw); //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; if(ws_result.response) { //if keyword exists } else { //if keyword does not exist } }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=keyword.keywordExists&username={username}&password={password}&api_key={api_key}&code=12345&keyword=Group keyword&word=Word Response if keyword already exists <?xml version="1.0" encoding="utf-8"?> <keywordExists> <message>Keyword exists.</message> <error_code></error_code> <result>true</result> <response>true</response> </keywordExists> Response if keyword does not exist. <?xml version="1.0" encoding="utf-8"?> <keywordExists> <message>Keyword does not exist.</message> <error_code></error_code> <result>true</result> <response>false</response> </keywordExists>
| static readKeyword | ( | $ | 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 keyword - String[40] (Required) - Keyword to be read |
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. auto_subscribe - Integer (Optional) - 1 = automatically subsribe to group 0 = do not subscribe callback_url - Returns callback_url if one is set note - Any notes set will be returned response - Response that is set for the keyword subscribed_response - Response set for already subscribed message word - Keyword name active - Keyword active status
<?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'; $auth['keyword'] = 'keyword_to_read'; $auth['code'] = 12345; $results = $soap->readKeyword($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"
<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:readKeyword 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>
<code xsi:type="xsd:string">12345</code>
<keyword xsi:type="xsd:string">keyword_to_read</keyword>
</auth>
</urn:readKeyword>
</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:readKeywordResponse>
<readKeywordReturn xsi:type="ns1:WSKeywordResponse">
<message xsi:type="xsd:string">Successfully read keyword.</message>
<response xsi:type="ns1:WSKeyword">
<auto_subscribe xsi:type="xsd:int">1</auto_subscribe>
<callback_url xsi:type="xsd:string">keyword callback</callback_url>
<note xsi:type="xsd:string"/>
<response xsi:type="xsd:string">keyword response</response>
<send_account_details xsi:type="xsd:int">0</send_account_details>
<subscribed_response xsi:type="xsd:string">keyword subscribed response</subscribed _response>
<word xsi:type="xsd:string">keyword word</word>
</response>
<result xsi:type="xsd:boolean">true</result>
</readKeywordReturn>
</ns1:readKeywordResponse>
</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"; auth.keyword = "keyword_to_read"; auth.code = "12345"; //create task bind WS_KeywordBinding bind = new WS_KeywordBinding(); bind.Url = "SSL//HOST_URL/webservices/keyword/2.0.0"; //create result object WSKeywordResponse ws_result = new WSKeywordResponse(); //call bind event ws_result = bind.readKeyword(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; WSKeyword keyword = ws_result.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=keyword.readKeyword&username={username}&password={password}&api_key={api_key}&code=12345&keyword=word Response <?xml version="1.0" encoding="utf-8"?> <readKeyword> <message>Successfully read keyword.</message> <error_code></error_code> <result>true</result> <response> <word>Word</word> <note></note> <response>Thanks for subscribing</response> <subscribed_response></subscribed_response> <callback_url></callback_url> <auto_subscribe>0</auto_subscribe> <keyword_type>5</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </response> </readKeyword>
| static updateKeyword | ( | $ | auth, |
| $ | keyword | ||
| ) | [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 keyword - String[40] (Required) - Default keyword for the group to be updated |
| WSKeyword | $keyword | Keyword Object app_identifier - String (Not Used) - This is used for internal purposes only auto_subscribe - Integer (Optional) - 1 = automatically subsribe to group 0 = do not subscribe callback_url - String (Optional) - Callback URL keyword_type - Integer (Required) - 1 = Subscription (Internal use only), 4 = Division (Internal use only), 5 = Custom, 6 = mCard note - String (Optional) - Miscellaneous notes entered here response - String (Optional) - Message to be sent to subscriber subscribed_response - String (Optional) - Message sent to subscriber if they try and opt in a second time word - String (Required) - Desired word to be added as the keyword WSCustomField - Object (Optional For mCard use only) - This is the object used to set mCard fields through the API name - String (Required) - title, company_name, website, first_name, last_name, office, mobile, email, address, city, state, zip, linkedin, blog, facebook, twitter value - String (Required) - Any value to be paired with the above designated fields. |
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. auto_subscribe - Integer (Optional) - 1 = automatically subsribe to group 0 = do not subscribe callback_url - Returns callback_url if one is set fields - Any mCard fields that are set note - Any notes set will be returned response - Response that is set for the keyword subscribed_response - Response set for already subscribed message word - Keyword name
<?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'; $auth['keyword'] = 'keyword_to_update'; $auth['code'] = 12345; //create customField object for mCard creation to pass in the keyword object $mCardFields = array(); $mCardFields[] = array('name'=>'title','value'=>'Mr.'); $mCardFields[] = array('name'=>'company_name','value'=>'Test'); $mCardFields[] = array('name'=>'website','value'=>'www.test.com'); $mCardFields[] = array('name'=>'first_name','value'=>'Test'); $mCardFields[] = array('name'=>'last_name','value'=>'Testers'); $mCardFields[] = array('name'=>'office','value'=>'888 555 4433'); $mCardFields[] = array('name'=>'mobile','value'=>'888 555 4422'); $mCardFields[] = array('name'=>'email','value'=>'test@test.com'); $mCardFields[] = array('name'=>'address','value'=>'123 Main 234 East'); $mCardFields[] = array('name'=>'city','value'=>'Cityville'); $mCardFields[] = array('name'=>'state','value'=>'ID'); $mCardFields[] = array('name'=>'zip','value'=>'83401'); $mCardFields[] = array('name'=>'linkedin','value'=>'www.linkedin.com/test'); $mCardFields[] = array('name'=>'blog','value'=>'test.blogspot.com'); $mCardFields[] = array('name'=>'facebook','value'=>'www.facebook.com/test'); $mCardFields[] = array('name'=>'twitter','value'=>'www.twitter.com/test'); //create a keyword object $kw = array(); $kw['word'] = 'new_kw1'; $kw['response'] = 'Response'; $kw['auto_subscribe'] = 1; $kw['subscribed_response'] = 'Subscribed response.'; $kw['keyword_type'] = 6; $kw['app_identifier'] = ''; $kw['callback_url'] = ''; $kw['note'] = ''; $kw['active'] = 1; $kw['fields'] = $mCardFields; $results = $soap->updateKeyword($auth, $kw, $mCardFields); 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:updateKeyword 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>
<code xsi:type="xsd:string">12345</code>
<keyword xsi:type="xsd:string">keyword_to_update</keyword>
</auth>
<keyword xsi:type="urn:WSKeyword">
<auto_subscribe xsi:type="xsd:integer">1</auto_subscribe>
<callback_url xsi:type="xsd:string">http://www.test.com/callback</callback_url>
<note xsi:type="xsd:string">Keyword note</note>
<response xsi:type="xsd:string">Auto Response</response>
<send_account_details xsi:type="xsd:integer">1</send_account_details>
<subscribed_response xsi:type="xsd:string">Already subscribed response</subscribed_response>
<word xsi:type="xsd:string">testkw</word>
<fields xsi:type="urn:WSCustomFieldArray" soapenc:arrayType="urn:WSCustomField[]">
<field>
<name>title</name>
<value>Mr.</value>
</field>
<field>
<name>company_name</name>
<value>TestCompany</value>
</field>
<field>
<name>website</name>
<value>www.test.com</value>
</field>
<field>
<name>first_name</name>
<value>Test</value>
</field>
<field>
<name>last_name</name>
<value>Tester</value>
</field>
<field>
<name>office</name>
<value>18885554433</value>
</field>
<field>
<name>mobile</name>
<value>18885554422</value>
</field>
<field>
<name>email</name>
<value>test@test.com</value>
</field>
<field>
<name>address</name>
<value>123 East 234 Main</value>
</field>
<field>
<name>city</name>
<value>Cityville</value>
</field>
<field>
<name>state</name>
<value>ID</value>
</field>
<field>
<name>zip</name>
<value>83401</value>
</field>
<field>
<name>linkedin</name>
<value>http://www.linkedin.com/pub/test</value>
</field>
<field>
<name>blog</name>
<value>www.test.blogspot.com</value>
</field>
<field>
<name>facebook</name>
<value>www.facebook.com/profile</value>
</field>
<field>
<name>twitter</name>
<value>https://twitter.com/#!/test</value>
</field>
</fields>
</keyword>
</urn:updateKeyword>
</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:updateKeywordResponse>
<updateKeywordReturn xsi:type="ns1:WSKeywordResponse">
<message xsi:type="xsd:string">Successfully updated keyword.</message>
<response xsi:type="ns1:WSKeyword">
<auto_subscribe xsi:type="xsd:int">1</auto_subscribe>
<callback_url xsi:type="xsd:string">http://www.test.com/callback</callback_url>
<note xsi:type="xsd:string">Keyword node</note>
<response xsi:type="xsd:string">Auto Response</response>
<send_account_details xsi:type="xsd:int">1</send_account_details>
<subscribed_response xsi:type="xsd:string">Already subscribed response</subscribed_response>
<word xsi:type="xsd:string">testkw</word>
<fields SOAP-ENC:arrayType="ns1:WSCustomField[1]" xsi:type="ns1:WSCustomFieldArray">
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">title</name>
<value xsi:type="xsd:string">Mr.</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">company_name</name>
<value xsi:type="xsd:string">TestCompany</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">website</name>
<value xsi:type="xsd:string">www.test.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">first_name</name>
<value xsi:type="xsd:string">Test</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">last_name</name>
<value xsi:type="xsd:string">Tester</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">office</name>
<value xsi:type="xsd:string">18885554433</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">mobile</name>
<value xsi:type="xsd:string">18885554422</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">email</name>
<value xsi:type="xsd:string">test@test.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">address</name>
<value xsi:type="xsd:string">123 East 234 Main</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">city</name>
<value xsi:type="xsd:string">Cityville</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">state</name>
<value xsi:type="xsd:string">Idaho</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">zip</name>
<value xsi:type="xsd:string">83401</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">linkedin</name>
<value xsi:type="xsd:string">http://www.linkedin.com/pub/test</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">blog</name>
<value xsi:type="xsd:string">www.test.blogspot.com</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">facebook</name>
<value xsi:type="xsd:string">www.facebook.com/profile</value>
</item>
<item xsi:type="ns1:WSCustomField">
<name xsi:type="xsd:string">twitter</name>
<value xsi:type="xsd:string">https://twitter.com/#!/test</value>
</item>
</response>
<result xsi:type="xsd:boolean">true</result>
</updateKeywordReturn>
</ns1:updateKeywordResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create task bind WS_KeywordBinding bind = new WS_KeywordBinding(); bind.Url = "SSL//HOST_URL/webservices/keyword/2.0.0"; //create web service authentication WSAuthentication auth = new WSAuthentication(); auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.keyword = "keyword to be updated"; auth.code = "12345"; List<WSCustomField> fields = new List<WSCustomField>(); //create customField object for mCard creation THIS IS ONLY TO BE USED IF YOU ARE CREATING AN MCARD KEYWORD, DISREGARD THIS IF YOU ARE CREATING WSCustomField field = new WSCustomField(); field.name = "title"; field.value = "Mr."; fields.Add(field); field = new WSCustomField(); field.name = "company_name"; field.value = "test"; fields.Add(field); field = new WSCustomField(); field.name = "website"; field.value = "www.test.com"; fields.Add(field); field = new WSCustomField(); field.name = "first_name"; field.value = "Test"; fields.Add(field); field = new WSCustomField(); field.name = "last_name"; field.value = "Tester"; fields.Add(field); field = new WSCustomField(); field.name = "office"; field.value = "18885554433"; fields.Add(field); field = new WSCustomField(); field.name = "mobile"; field.value = "18885554422"; fields.Add(field); field = new WSCustomField(); field.name = "email"; field.value = "test@test.com"; fields.Add(field); field = new WSCustomField(); field.name = "address"; field.value = "123 East 234 Main"; fields.Add(field); field = new WSCustomField(); field.name = "city"; field.value = "Cityville"; fields.Add(field); field = new WSCustomField(); field.name = "state"; field.value = "ID"; fields.Add(field); field = new WSCustomField(); field.name = "zip"; field.value = "83401"; fields.Add(field); field = new WSCustomField(); field.name = "linkedin"; field.value = "www.linkedin.com/test"; fields.Add(field); field = new WSCustomField(); field.name = "blog"; field.value = "www.test.blogspot.com"; fields.Add(field); field = new WSCustomField(); field.name = "facebook"; field.value = "www.facebook.com/test"; fields.Add(field); field = new WSCustomField(); field.name = "twitter"; field.value = "www.twitter.com/test"; fields.Add(field); //create keyword object WSKeyword kw = new WSKeyword(); kw.auto_subscribe = 1; kw.callback_url = "SSL//www.test.com/callback"; kw.note = "Keyword note"; kw.response = "Auto Response"; kw.send_account_details = 1; kw.subscribed_response = "Already subscribed response"; kw.word = "testkw1"; kw.active = true; kw.keyword_type = 6; kw.fields = fields.ToArray(); //create result object WSKeywordResponse ws_result = new WSKeywordResponse(); //call bind event ws_result = bind.updateKeyword(auth,kw); //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; WSKeyword keyword = ws_result.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=keyword.updateKeyword&username={username}&password={password}&api_key={api_key}&code=12345&keyword=Word&word=Word&auto_subscribe=0&keyword_type=5&response=Thanks for subscribing-updated&subscribed_response=Already subscribed - updated Response <?xml version="1.0" encoding="utf-8"?> <updateKeyword> <message>Successfully updated keyword.</message> <error_code></error_code> <result>true</result> <response> <word>Word</word> <note></note> <response>Thanks for subscribing-updated</response> <subscribed_response>Already subscribed - updated</subscribed_response> <callback_url></callback_url> <auto_subscribe>0</auto_subscribe> <keyword_type>5</keyword_type> <app_identifier></app_identifier> <active>1</active> <fields></fields> </response> </updateKeyword>