<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Text Marketer - Email SMS, Bulk SMS Gateway, SMS Marketing Blog &#187; Web to SMS</title>
	<atom:link href="http://www.textmarketer.co.uk/blog/tag/web-to-sms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.textmarketer.co.uk/blog</link>
	<description>SMS Gateway</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>RESTful Web Services SMS Gateway API Overview</title>
		<link>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/</link>
		<comments>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:57:26 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Business SMS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web to SMS]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[integrate]]></category>
		<category><![CDATA[RESTful]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[sms api]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=1107</guid>
		<description><![CDATA[This blog post has been superseded with our website documentation In addition to our simple HTTP SMS Gateway API, explained here, we also provide a &#8216;RESTful&#8217; SMS API to give you access to information about your SMS marketing account (don&#8217;t have one? Create a free account). If you are familiar with REST APIs, &#8230; <a href="http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.textmarketer.co.uk/developers/restful-api.htm">This blog post has been superseded with our website documentation</a></p>
<p>In addition to our simple HTTP <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">SMS Gateway API</a>, explained <a title="SMS Gateway API" href="/blog/2009/05/sms-gateway/text-marketer-apigateway-spec/">here</a>, we also provide a &#8216;RESTful&#8217; SMS API to give you access to information about your <a title="Get an SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_self">SMS marketing account</a> (don&#8217;t have one? Create a <a title="Free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/">free account</a>).</p>
<p>If you are familiar with REST APIs, you may wish to jump to our <a title="REST SMS API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/" target="_self">REST API specification document</a>.</p>
<p><strong>WHAT&#8217;S A &#8216;RESTful&#8217; SMS API?</strong></p>
<p>REST is a term used to describe a type of two-way communication via the Internet. It is an architectural style, not a standard, but makes use of well-known web technologies such as <a title="HTTP Protocol" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">HTTP</a>, <a title="XML Language" href="http://en.wikipedia.org/wiki/Xml" target="_blank">XML</a> and <a title="MIME types" href="http://en.wikipedia.org/wiki/Mime_types" target="_blank">MIME types</a>. For more information about REST APIs, read <a title="REST Web Services" href="http://www.xfront.com/REST-Web-Services.html" target="_blank">this great description of REST</a>.</p>
<p>At its most simple, our <a title="RESTful Web Services" href="http://http://www.xfront.com/REST-Web-Services.html" target="_blank">RESTful</a> SMS API allows you to request (&#8216;GET&#8217;) information. For example, from this &#8216;resource&#8217;</p>
<p><a title="REST SMS API resource example" href="http://www.textmarketer.biz/services/rest/credits" target="_blank"><em></em></a><em><a title="Credits resource" href="http://www.textmarketer.biz/services/rest/credits" target="_blank">http://www.textmarketer.biz/services/rest/credits</a> </em></p>
<p>you can access the number of credits available in your account. The response is an XML document that looks like this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-19T09:37:26+00:00"</span>&gt;
&lt;<span class="start-tag">credits</span>&gt;37&lt;/<span class="end-tag">credits</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>The SMS REST API is that simple!</p>
<p><strong>WHAT ABOUT SECURITY?</strong></p>
<p>Although it&#8217;s not apparent from the example above, the interface does require authentication using your SMS API account username/password. We provide two ways of passing this information to the server.</p>
<p>The first is via <a title="HTTP Basic Auth" href="http://en.wikipedia.org/wiki/Basic_access_authentication" target="_blank">HTTP Basic Authentication</a>, which is demonstrated by the login box that appears if you click on the resource link above. HTTP Basic authentication can of course be handled within your code. However if you prefer a simpler method, you can pass the parameters via the URL as GET arguments, e.g.</p>
<p><em><a>http://www.textmarketer.biz/services/rest/credits?username=myusername&amp;password=mypassword</a></em></p>
<p>It is also recommended that you use encrypted communication with the REST Web Services by accessing resources via the HTTPS protocol (<em><a>https://&#8230; etc.)</a></em>.</p>
<p><strong>HOW DOES THE RESTful API HANDLE ERRORS?</strong></p>
<p>An advantage of using a RESTful API is that the underlying technologies already do a lot of the work for us. All responses via the HTTP protocol include headers that give us some information about the response. The headers in the above example would look like this:</p>
<pre>Date: Fri, 19 Mar 2010 10:11:40 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>The MIME type (Content-Type) is set to application/xml which identifies the type of content in the response. It is followed by the response status code &#8217;200&#8242; and the status message &#8216;OK&#8217;. This is a standard response to a successful request.</p>
<p>If we had tried to access a resource which didn&#8217;t exist, e.g.</p>
<p><a title="Bad request" href="http://www.textmarketer.biz/services/rest/anotherResource" target="_blank">http://www.textmarketer.biz/services/rest/anotherResource</a></p>
<p>we would get the following response headers:</p>
<pre>Date: Fri, 19 Mar 2010 10:18:23 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 549
Connection: close
Content-Type: application/xml

404 Not Found :  (ERR101)</pre>
<p>The status code is 404, which is the HTTP protocol&#8217;s standard code for &#8216;resource not found&#8217;. The status message also contains some additional debugging information (ERR91) which you can ignore.</p>
<p>In addition to the status code, the response body contains XML detailing the error. In this example it might look like this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T14:45:54+00:00"</span>&gt;
&lt;<span class="start-tag">errors</span>&gt;
	&lt;<span class="start-tag">error</span><span class="attribute-name"> code</span>=<span class="attribute-value">"404"</span>&gt;Not Found :  (ERR101)&lt;/<span class="end-tag">error</span>&gt;
&lt;/<span class="end-tag">errors</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>Thus, you can check the header status code for an error code, as well  as the response body.</p>
<p><strong>WHAT RESOURCES CAN I ACCESS THROUGH THE REST SMS API?</strong></p>
<p>At the moment, the resource URIs available to you are:</p>
<ul>
<li><a title="Credits resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#credits_resource"><em>http://www.textmarketer.biz/services/rest/credits</em></a> &#8211; to get the credits available on your account / transfer credits between accounts</li>
<li><a title="deliveryReports resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#deliveryReports_resource"><em>http://www.textmarketer.biz/services/rest/deliveryReports</em></a> &#8211; to list your delivery reports</li>
<li><a title="deliveryReport resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#deliveryReport_resource"><em>http://www.textmarketer.biz/services/rest/deliveryReport/</em>a_report_name</a> &#8211; to access the details of a specific report</li>
<li><a title="sms resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource"><em>http://www.textmarketer.biz/services/rest/sms</em></a> &#8211; to send an SMS</li>
<li><em><a title="keywords resource" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#keywords_resource">http://www.textmarketer.biz/services/rest/keywords</a></em> &#8211; to get the availability of a given keyword (see <a href="http://www.textmarketer.co.uk/shortcode_sms.htm" target="_blank">Short Code SMS Service</a>)</li>
</ul>
<p>More will be added in the future.</p>
<p>Here are 2 walk-through examples for using the REST SMS API.</p>
<p><strong>EXAMPLE REQUEST 1 &#8211; GET CREDITS</strong></p>
<p>Make an HTTP GET request like this:</p>
<p><em></em><em><a>http://www.textmarketer.biz/services/rest/credits?username=myAPIusername&amp;password=myAPIpassword</a></em></p>
<p>Obviously, replace &#8216;myAPIusername&#8217; and &#8216;myAPIpassword&#8217; in the URL with the ones you received when you <a title="Sign up for free SMS account" href="http://www.textmarketer.co.uk/signUpGoogle/" target="_blank">signed up</a>.</p>
<p>When you send this request using your favorite programming language, you should receive the following HTTP <em>headers</em> in response:</p>
<pre>Date: Wed, 24 Mar 2010 15:17:28 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>Using your programming language, you can easily extract the status code (200 in this case), which indicates success (200) or failure (not 200). The status code of 200 here shows us the request was successful, i.e. the response contains the number of credits in your account.</p>
<p>Thus the HTTP response <em>body</em> that you receive will contain XML similar to this:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T15:17:28+00:00"</span>&gt;
&lt;<span class="start-tag">credits</span>&gt;10&lt;/<span class="end-tag">credits</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p>In your programming language you can parse the XML to extract the value of the credits, in this case 10.</p>
<p>But if, for example, you use an incorrect password, the response headers will look like this:</p>
<pre>Date: Wed, 24 Mar 2010 15:30:10 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 377
Connection: close
Content-Type: application/xml

403 Forbidden : Your username/password combination did not match an account. (ERR145)</pre>
<p>The 403 status code shows that an error occurred (all codes except 200 indicate an error). And the XML response body will also contain:</p>
<pre>&lt;<span class="start-tag">response</span><span class="attribute-name"> processed_date</span>=<span class="attribute-value">"2010-03-24T15:29:22+00:00"</span>&gt;
&lt;<span class="start-tag">errors</span>&gt;
	&lt;<span class="start-tag">error</span><span class="attribute-name"> code</span>=<span class="attribute-value">"403"</span>&gt;Forbidden : Your username/password combination did not match an account. (ERR145)&lt;/<span class="end-tag">error</span>&gt;
&lt;/<span class="end-tag">errors</span>&gt;
&lt;/<span class="end-tag">response</span>&gt;</pre>
<p><strong>EXAMPLE REQUEST 2 &#8211; SEND SMS</strong></p>
<p>In your programming language, create an HTTP <em>POST</em> request to this URL:</p>
<p><em>http://www.textmarketer.biz/services/rest/sms</em></p>
<p>Since this is a POST request, you cannot pass the username and password via the URL, so you need to use HTTP Digest Authentication, or simply include these parameters along with the other POST parameters you&#8217;ll need:</p>
<ul>
<li>message=&#8217;my message&#8217;</li>
<li>originator=&#8217;me&#8217;</li>
<li>mobile_number=&#8217;447777777777&#8242;</li>
<li>username=&#8217;myAPIusername&#8217; (replace with your own &#8211; or skip this parameter and use HTTP Digest Authentication)</li>
<li>password=&#8217;myAPIpassword&#8217; (replace with your own &#8211; or skip this parameter and use HTTP Digest Authentication)</li>
</ul>
<p>POSTing an HTTP request using the above as POST parameters would send an SMS message of &#8216;my message&#8217; to the mobile number 447777777777 from &#8220;me&#8221;.</p>
<p>NOTE: It will not work to pass these parameters as GET arguments (e.g. by appending them to the URL); this is the principle of a REST API.</p>
<p>Your HTTP POST request should return something similar to the following response headers:</p>
<pre>Date: Wed, 24 Mar 2010 15:17:28 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 272
Connection: close
Content-Type: application/xml

200 OK</pre>
<p>&#8230;the &#8217;200&#8242; status code showing that your request was successful. The HTTP response body will consist of XML containing the ID of the SMS sent as well as the number of credits used to send it:</p>
<pre>&lt;response processed_date="2010-03-23T10:31:39+00:00"&gt;
	&lt;message_id&gt;4172870907&lt;/message_id&gt;
	&lt;credits_used&gt;1&lt;/credits_used&gt;
&lt;/response&gt;</pre>
<p>If, however, there was a problem with your request parameters, for example you set mobile_number to &#8216;garbage&#8217;, you would get similar response headers to this:</p>
<pre>Date: Wed, 24 Mar 2010 15:30:10 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.11 ZendServer/4.0
Content-Length: 377
Connection: close
Content-Type: application/xml

404 Bad request</pre>
<p>And the response body would contain XML detailing the precise problems with your request, like this:</p>
<pre><span><span style="color: #cc0000;"><span style="color: #000000;">&lt;response processed_date="2010-03-24T14:37:41+00:00"&gt;
&lt;errors&gt;
	&lt;error code="10"&gt;invalid number or not an integer&lt;/error&gt;
	&lt;error code="9"&gt;invalid number or too short&lt;/error&gt;
&lt;/errors&gt;
&lt;/response&gt;
</span></span></span></pre>
<p>See the <a title="sms resource" href="http://www.textmarketer.co.uk/blog/2010/03/business-sms/rest-sms-api-specification-document/#sms_resource">specification of the sms resource</a> for more details of the possible error codes.</p>
<p><strong>TESTING/SANDBOX</strong></p>
<p>A <a title="Sandbox API" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/#sandbox">sandbox service</a> is available for testing your code without changing your account or using any credits.</p>
<p><strong>MORE INFORMATION</strong></p>
<p>For detailed information about our RESTful SMS API, please see our <a title="REST SMS API specification" href="/blog/2010/03/business-sms/rest-sms-api-specification-document/" target="_self">REST  API specification document</a>.</p>
<p>For reference, a list of the DTDs that correspond to the  resources available can be <a title="Web Services DTDs" href="http://www.textmarketer.biz/services/rest/DTD/" target="_blank">found here</a>.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=1107&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2010/03/sms-gateway/restful-web-services-sms-api-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to integrate our SMS Gateway API into your systems</title>
		<link>http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/how-to-integrate-our-sms-gateway-api-into-your-systems/</link>
		<comments>http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/how-to-integrate-our-sms-gateway-api-into-your-systems/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:34:32 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[All SMS Gateway Documentation]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[integrate]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[Web to SMS]]></category>

		<guid isPermaLink="false">http://87.106.109.73/blog/?p=70</guid>
		<description><![CDATA[Introduction Adding SMS as a communication method to a system is often very useful, for instance you don&#8217;t have issues with spam filtering, it doesn&#8217;t require the person to make an immediate response like a phone call, so it&#8217;s great for alerts and triggers. Another good application for SMS (text &#8230; <a href="http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/how-to-integrate-our-sms-gateway-api-into-your-systems/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Adding SMS as a communication method to a system is often very useful, for instance you don&#8217;t have issues with spam filtering, it doesn&#8217;t require the person to make an immediate response like a phone call, so it&#8217;s great for alerts and triggers. Another good application for SMS (text messaging) which is often over looked is the ability to use it as a method to update a system or retrieve information without needing any equipment other than a mobile phone, any one would work. This is done using a short code.</p>
<p><strong>Consider this example:</strong></p>
<p>You own a fictitious &#8220;temporary employment agency&#8221; with several hundred people on your books.  Your client has asked you to fulfill a specific job such as a receptionist. You send an SMS:</p>
<p><strong>Receptionist cover required for 2 weeks 4 hr per day @ £10 per hr, location Bristol. Reply with &#8220;more 4567a&#8221; for more info.</strong></p>
<p>The last bit (more 4567a) is the information that allows us to automate things, the keyword <strong>more</strong> is used to identify you, and the code would be a reference to the job. The potential candidate could then reply where by (in this case) you could :</p>
<ol>
<li>Send more details from the job description</li>
<li>Update the database that this person is a likely candidate</li>
<li>The person has expressed interest in the receptionist job, we could make an assumption that they maybe interested in other receptionist jobs so you could start creating groups that could be used for later targeting.</li>
</ol>
<h2>Implementation</h2>
<p><strong>So how do we set up the <a title="SMS Gateway" href="http://www.textmarketer.co.uk/sms-gateway.htm">SMS gateway</a> and send messages? Fortunately it&#8217;s easy.</strong><br />
First you need an <a href="http://www.textmarketer.co.uk/free-bulk-sms-software.htm">account</a> (it&#8217;s free) and automated. You&#8217;ll get the user name and password you need plus you get some free sends. You will also need to ask for the API URL.</p>
<p>Next use the out bound API (sometimes called an SMS gateway) for your message. This is a simple HTTP GET request which can either be sent via http or https. You will need to url encode the message.<br />
<strong>http://&lt;request the url&gt;?username=myUsername&amp;password=myPassword&amp;number=447777777777&amp;message=Receptionist+cover+required+for+2+weeks+4+hr+per+day+%40+%C2%A310+per+hr%2C+location+Bristol.+Reply+with+%22more+4567a%22&amp;orig=88802</strong><br />
You can try the above in any old browser.</p>
<p><a title="Example PHP5 send SMS class" href="http://www.textmarketer.co.uk/blog/2009/05/technical/text-marketer-apigateway-spec/" target="_blank">There is an example class (in PHP 5)</a> that would do this for you</p>
<h3>Next we want to use the incoming response from the recipient</h3>
<p>This is the bit where we need to speak to or email the company,  a keyword is required  (which is free) on the 88802 short code, in our example we are using the word &#8220;more&#8221;. You then supply Text Marketer with a URL on your domain that will get notified with the parameters once a response is received. For example www.mydomain.com/myscript.php</p>
<p>If the applicant replied with &#8220;more 4567a&#8221; you would receive an HTTP GET like this <strong>http://www.mydomain.com/myscript.php?number=4477777777&amp;message=more+4567a&amp;network=ORANGEUK</strong></p>
<p>It is then up to you how you use this information, the example gives a few ideas.</p>
<img src="http://www.textmarketer.co.uk/wordpress/?ak_action=api_record_view&id=70&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.textmarketer.co.uk/blog/2009/05/sms-gateway/how-to-integrate-our-sms-gateway-api-into-your-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

