Static Public Member Functions | |
| static | createTemplate ($auth, $template) |
| static | deleteTemplate ($auth, $template) |
| static | getTemplates ($auth) |
| static | readTemplate ($auth, $template) |
| static | restoreTemplate ($auth, $template) |
| static | updateTemplate ($auth, $template) |
| static createTemplate | ( | $ | auth, |
| $ | template | ||
| ) | [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 |
| WSTemplate | $template | Template Object id - String (Required) - ID to give the template title - String (Optional) - Title of the template subject - String (Optional) - Subject of the template text - String (Optional) - Actual message of the template description - String (Optional) - Added description or note of the template |
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. id - Template id description - Template description subject - Template subject text - Template message title - Template title/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['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; //template to search for $template['id'] = 'template id'; $template['title'] = 'template title'; $template['subject'] = 'template subject'; $template['text'] = 'template text'; $template['description'] = 'template description'; $results = $soap->createTemplate($auth, $template); 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:createTemplate 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</keyword>
</auth>
<template xsi:type="urn:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<title xsi:type="xsd:string">template title</title>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<description xsi:type="xsd:string">template description</description>
</template>
</urn:createTemplate>
</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:createTemplateResponse>
<createTemplateReturn xsi:type="ns1:WSTemplateResponse">
<message xsi:type="xsd:string">Successfully created template.</message>
<response xsi:type="ns1:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<description xsi:type="xsd:string">template description</description>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<title xsi:type="xsd:string">template title</title>
</response>
<result xsi:type="xsd:boolean">true</result>
</createTemplateReturn>
</ns1:createTemplateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //Create Template WSTemplate template = new WSTemplate(); template.id = "template id"; template.description = "template description"; template.subject = "template subject"; template.text = "Your name is {name} and you owe {amount}."; template.title = "Template title"; //call bind event WSTemplateResponse response = bind.createTemplate(auth, template); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; WSTemplate ret_template = response.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.createTemplate&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group Keyword}&id=123&title=templateTitle&text=templateText&subject=templateSubject&description=templateDesc Response <?xml version="1.0" encoding="utf-8"?> <createTemplate> <message>Successfully created template.</message> <error_code></error_code> <result>true</result> <response> <id>123</id> <title>templateTitle</title> <text>templateText</text> <subject>templateSubject</subject> <description>templateDesc</description> </response> </createTemplate>
| static deleteTemplate | ( | $ | auth, |
| $ | template | ||
| ) | [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 |
| WSTemplate | $template | Template Object id - String (Required) - The id given when created |
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 deletion 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'; $auth['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; //template to search for $template['id'] = 'template id'; $template['title'] = 'template title'; $template['subject'] = 'template subject'; $template['text'] = 'template text'; $template['description'] = 'template description'; $results = $soap->deleteDemplate($auth, $template); 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:deleteTemplate 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</keyword>
</auth>
<template xsi:type="urn:WSTemplate">
<id xsi:type="xsd:string">template id</id>
</template>
</urn:deleteTemplate>
</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:deleteTemplateResponse>
<deleteTemplateReturn xsi:type="ns1:WSTemplateResponse">
<message xsi:type="xsd:string">Successfully deleted template.</message>
<response xsi:nil="true" xsi:type="ns1:WSTemplate"/>
<result xsi:type="xsd:boolean">true</result>
</deleteTemplateReturn>
</ns1:deleteTemplateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //Create Template WSTemplate template = new WSTemplate(); template.id = "template id"; //call bind event WSTemplateResponse response = bind.deleteTemplate(auth, template); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.deleteTemplate&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group Keyword}&id=123 Response <?xml version="1.0" encoding="utf-8"?> <deleteTemplate> <message>Successfully deleted template.</message> <error_code></error_code> <result>true</result> <response></response> </deleteTemplate>
| static getTemplates | ( | $ | 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. id - Template id description - Template description subject - Template subject text - Template message title - Template title/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['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; $results = $soap->getTemplates($auth); print_r($results); if ($results->result == 0 || $results->error > 0) { //error processing throw new Exception($results->message); } else { //after success processing }
XML 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:getTemplates 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</keyword>
</auth>
</urn:getTemplates>
</soapenv:Body>
</soapenv:Envelope>
XML 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:getTemplatesResponse>
<getTemplatesReturn xsi:type="ns1:WSTemplateListResponse">
<message xsi:type="xsd:string">Successfully retrieved templates.</message>
<response xsi:type="ns1:WSTemplateList">
<templates SOAP-ENC:arrayType="ns1:WSTemplate[1]" xsi:type="ns1:WSTemplateArray">
<item xsi:type="ns1:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<description xsi:type="xsd:string"/>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template test</text>
<title xsi:type="xsd:string">template title</title>
</item>
</templates>
</response>
<result xsi:type="xsd:boolean">true</result>
</getTemplatesReturn>
</ns1:getTemplatesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //call bind event WSTemplateListResponse response = bind.getTemplates(auth); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; WSTemplateList list = response.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.getTemplates&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group keyword} Response <?xml version="1.0" encoding="utf-8"?> <getTemplates> <message>Successfully retrieved templates.</message> <error_code></error_code> <result>true</result> <response> <templates> <item> <id>800</id> <title>templateTitle</title> <text>templateText</text> <subject>templateSubject</subject> <description>templateDesc</description> </item> </templates> </response> </getTemplates>
| static readTemplate | ( | $ | auth, |
| $ | template | ||
| ) | [static] |
Description:
| WSAuthentication | $auth | Athentication 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 |
| WSTemplate | $template | Template Object id - String (Required) - The id given when created |
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. id - Template id description - Template description subject - Template subject text - Template message title - Template title/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['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; //template to search for $template['id'] = 'template id'; $template['title'] = 'template title'; $template['subject'] = 'template subject'; $template['text'] = 'template text'; $template['description'] = 'template description'; $results = $soap->readTemplate($auth, $template); 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:readTemplate 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</keyword>
</auth>
<template xsi:type="urn:WSTemplate">
<id xsi:type="xsd:string">template id</id>
</template>
</urn:readTemplate>
</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:readTemplateResponse>
<readTemplateReturn xsi:type="ns1:WSTemplateResponse">
<message xsi:type="xsd:string">Successfully read template.</message>
<response xsi:type="ns1:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<description xsi:type="xsd:string"/>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<title xsi:type="xsd:string">template title</title>
</response>
<result xsi:type="xsd:boolean">true</result>
</readTemplateReturn>
</ns1:readTemplateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //Read Template WSTemplate template = new WSTemplate(); template.id = "template id"; //call bind event WSTemplateResponse response = bind.readTemplate(auth, template); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; WSTemplate t = response.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.readTemplate&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group Keyword}&id=123 Response <?xml version="1.0" encoding="utf-8"?> <readTemplate> <message>Successfully read template.</message> <error_code></error_code> <result>true</result> <response> <id>12321</id> <title>templateTitle</title> <text>templateText</text> <subject>templateSubject</subject> <description>templateDesc</description> </response> </readTemplate>
| static restoreTemplate | ( | $ | auth, |
| $ | template | ||
| ) | [static] |
Description:
| WSAuthentication | $auth | Athentication 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 |
| WSTemplate | $template | Template Object id - String (Required) - The id given when created |
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. id - Template id description - Template description subject - Template subject text - Template message title - Template title/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['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; //template to search for $template['id'] = 'template id'; $template['title'] = 'template title'; $template['subject'] = 'template subject'; $template['text'] = 'template text'; $template['description'] = 'template description'; $results = $soap->restoreTemplate($auth, $template); 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:restoreTemplate 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</keyword>
</auth>
<template xsi:type="urn:WSTemplate">
<id xsi:type="xsd:string">template id</id>
</template>
</urn:restoreTemplate>
</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:restoreTemplateResponse>
<restoreTemplateReturn xsi:type="ns1:WSTemplateResponse">
<message xsi:type="xsd:string">Successfully restored template.</message>
<response xsi:type="ns1:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<description xsi:type="xsd:string">template description</description>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<title xsi:type="xsd:string">template title</title>
</response>
<result xsi:type="xsd:boolean">true</result>
</restoreTemplateReturn>
</ns1:restoreTemplateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //Create Template WSTemplate template = new WSTemplate(); template.id = "template id"; //call bind event WSTemplateResponse response = bind.restoreTemplate(auth, template); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; WSTemplate t = response.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.restoreTemplate&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group Keyword}&id=123 Response <?xml version="1.0" encoding="utf-8"?> <restoreTemplate> <message>Successfully restored template.</message> <error_code></error_code> <result>true</result> <response> <id>123</id> <title>templateTitle-updated</title> <text>templateText-updated</text> <subject>templateSubject-updated</subject> <description>templateDesc-updated</description> </response> </restoreTemplate>
| static updateTemplate | ( | $ | auth, |
| $ | template | ||
| ) | [static] |
Description:
| WSAuthentication | $auth | Athentication 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 |
| WSTemplate | $template | Template Object id - String (Required) - Id of the template title - String (Optional) - Title of the template subject - String (Optional) - Subject of the template text - String (Optional) - Actual message of the template description - String (Optional) - Added description or note of the template |
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. id - Template id description - Template description subject - Template subject text - Template message title - Template title/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['code'] = '12345'; $auth['keyword'] = 'division or group keyword'; //template to search for $template['id'] = 'template id'; $template['title'] = 'template title'; $template['subject'] = 'template subject'; $template['text'] = 'template text'; $template['description'] = 'template description'; $results = $soap->updateTemplate($auth, $template); 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:updateTemplate 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</keyword>
</auth>
<template xsi:type="urn:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<title xsi:type="xsd:string">template title</title>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<description xsi:type="xsd:string">template description</description>
</template>
</urn:updateTemplate>
</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:updateTemplateResponse>
<updateTemplateReturn xsi:type="ns1:WSTemplateResponse">
<message xsi:type="xsd:string">Successfully updated template.</message>
<response xsi:type="ns1:WSTemplate">
<id xsi:type="xsd:string">template id</id>
<description xsi:type="xsd:string">template description</description>
<subject xsi:type="xsd:string">template subject</subject>
<text xsi:type="xsd:string">template text</text>
<title xsi:type="xsd:string">template title</title>
</response>
<result xsi:type="xsd:boolean">true</result>
</updateTemplateReturn>
</ns1:updateTemplateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//create binding WS_TemplateBinding bind = new WS_TemplateBinding(); bind.Url = "SSL//HOST_URL/webservices/template/2.0.0"; //create authentication object WSAuthentication auth = new WSAuthentication(); auth.username = "api_username"; auth.password = "api_password"; auth.api_key = "xxxxxxxxxxxxxx"; auth.code = "12345"; auth.keyword = "division or group keyword"; //Create Template WSTemplate template = new WSTemplate(); template.id = "template id"; template.description = "new template description"; template.subject = "new template subject"; template.text = "Your name is {name} and you owe {amount}."; template.title = "new template title"; //call bind event WSTemplateResponse response = bind.updateTemplate(auth, template); //process response if(!response.result) { //handle error label.Text = response.message; } else { //handle success label.Text = response.message; WSTemplate t = response.response; }
Request SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=template.updateTemplate&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company, Division or Group keyword}&id=123&title=templateTitle-updated&text=templateText-updated&subject=templateSubject-updated&description=templateDesc-updated Response <?xml version="1.0" encoding="utf-8"?> <updateTemplate> <message>Successfully updated template.</message> <error_code></error_code> <result>true</result> <response> <id>123</id> <title>templateTitle-updated</title> <text>templateText-updated</text> <subject>templateSubject-updated</subject> <description>templateDesc-updated</description> </response> </updateTemplate>