5
0
mirror of https://github.com/cwinfo/envayasms.git synced 2025-01-10 04:05:38 +00:00

add server api examples

This commit is contained in:
Jesse Young 2011-09-18 21:42:01 -07:00
parent c4502447a6
commit 4d3350b3fd
4 changed files with 118 additions and 16 deletions

View File

@ -93,7 +93,7 @@ The following HTTP Headers are sent in all POST requests from KalSMS:
<li>the password,</li>
</ul>
with a comma in between each element, like so:
<br /><br />
<br />
<code>"&lt;serverURL&gt;,&lt;name1&gt;,&lt;value1&gt;,&lt;...&gt;,&lt;nameN&gt;,&lt;valueN&gt;,&lt;password&gt;"</code>
</li>
@ -192,6 +192,51 @@ Additional parameters sent in POST requests with action=send_status:
</dd>
</dl>
Example request for incoming SMS message:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: sAemG31uRllk/K9xck2WRNaF/WI=
Content-Length: 96
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
from=6505551234&message_type=sms&message=test&version=2&phone_number=16505551212&action=incoming
</pre>
Example request for incoming MMS message:
<pre>
TODO
</pre>
Example request for checking for outgoing SMS messages:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: 139CL71b7r1Zw/E2wcccWFviSlg=
Content-Length: 50
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
action=outgoing&version=2&phone_number=16505551212
</pre>
Example request for notifying status of sent message:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: 6uJtI6+QqlVBbUsR4T0WsQomods=
Content-Length: 80
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
id=1536&status=sent&error=&action=send_status&version=2&phone_number=16505551212
</pre>
<h3>
HTTP Response Format
</h4>
@ -247,14 +292,18 @@ The Content-Type header should be text/xml, with the content as follows:
</dd>
</dl>
Example:
Example response:
<pre>
&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;messages&gt;
&lt;sms id='42' to='5551212'&gt;Message One&lt;/sms&gt;
&lt;sms&gt;Message Two&lt;/sms&gt;
&lt;/message&gt;
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 189
&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;messages&gt;
&lt;sms id='1540' to='16505551213'&gt;This is a test&lt;/sms&gt;
&lt;sms id='1541' to='16505551214'&gt;This is a another test message.&lt;/sms&gt;
&lt;/messages&gt;
</pre>
</blockquote>

View File

@ -55,7 +55,9 @@ h3 { color: #678bf0; }
a { color: #678bf0; }
.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
.download { float: right; }
pre { background: #000; color: #fff; padding: 15px;}
pre {
background: #eee; color: #333; padding: 5px;
}
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
.footer { text-align:center; padding-top:30px; font-style: italic; }

View File

@ -123,7 +123,7 @@ The following HTTP Headers are sent in all POST requests from KalSMS:
<li>the password,</li>
</ul>
with a comma in between each element, like so:
<br /><br />
<br />
<code>"&lt;serverURL&gt;,&lt;name1&gt;,&lt;value1&gt;,&lt;...&gt;,&lt;nameN&gt;,&lt;valueN&gt;,&lt;password&gt;"</code>
</li>
@ -222,6 +222,51 @@ Additional parameters sent in POST requests with action=send_status:
</dd>
</dl>
Example request for incoming SMS message:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: sAemG31uRllk/K9xck2WRNaF/WI=
Content-Length: 96
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
from=6505551234&message_type=sms&message=test&version=2&phone_number=16505551212&action=incoming
</pre>
Example request for incoming MMS message:
<pre>
TODO
</pre>
Example request for checking for outgoing SMS messages:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: 139CL71b7r1Zw/E2wcccWFviSlg=
Content-Length: 50
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
action=outgoing&version=2&phone_number=16505551212
</pre>
Example request for notifying status of sent message:
<pre>
POST /sg/kalsms HTTP/1.1
X-Kalsms-Signature: 6uJtI6+QqlVBbUsR4T0WsQomods=
Content-Length: 80
Content-Type: application/x-www-form-urlencoded
Host: 192.168.70.1:3000
Connection: Keep-Alive
id=1536&status=sent&error=&action=send_status&version=2&phone_number=16505551212
</pre>
<h3>
HTTP Response Format
</h4>
@ -277,14 +322,18 @@ The Content-Type header should be text/xml, with the content as follows:
</dd>
</dl>
Example:
Example response:
<pre>
&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;messages&gt;
&lt;sms id='42' to='5551212'&gt;Message One&lt;/sms&gt;
&lt;sms&gt;Message Two&lt;/sms&gt;
&lt;/message&gt;
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 189
&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;messages&gt;
&lt;sms id='1540' to='16505551213'&gt;This is a test&lt;/sms&gt;
&lt;sms id='1541' to='16505551214'&gt;This is a another test message.&lt;/sms&gt;
&lt;/messages&gt;
</pre>
</blockquote>

View File

@ -55,7 +55,9 @@ h3 { color: #678bf0; }
a { color: #678bf0; }
.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
.download { float: right; }
pre { background: #000; color: #fff; padding: 15px;}
pre {
background: #eee; color: #333; padding: 5px;
}
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
.footer { text-align:center; padding-top:30px; font-style: italic; }