What is an HTTP API?
Send textSMS using an HTTP API URL using the internet. An HTTP API is a simple set of query parameters in a URL, allowing website owners and programmers to send SMS using the internet.
Using an HTTP API is one of the most common ways programmers use to allow the Web to send text SMS to handsets. (Application to Person or A2P messaging – this type of messaging could be application to handset/user or user to application also known as replies).
Programmers combine API URL’s with a web form and a script to enable website users to send SMS to handsets.
In our previous article, we described how to send text SMS using a website. This website is an example of our HTTP API at work.
How does an HTTP API work?
An HTTP API is in simple terms a query string which users may use in a web browser to send a text SMS. There are different API’s and each text SMS supplier has their own documentation. HTTP API’s are in general not charged for as it is seen as supplying a service to customers.
Our API URL looks like this:
User/systemid = Username – we set users up with a test account and supply a Username and password
pass = password
sid = sender id of the message
mno = destination mobile number
text = message text
type = message type [0, 1, 2, 3, 4,5 ]
esm = esm class for message
dcs = data coding scheme
Concatenated Unicode message type =0 esm = 64, dcs =8 , limit(280)
( Note :esm for any concatenated message will be 64)
Concatenated English message type =5 esm = 64, dcs =0 , limit(280)
Ring Tone message type = 0 esm = 64, dcs =245, limit(320)
Greek message type = 0 esm = 0, dcs =0 , limit(320)
English message type = 1 esm = 0, dcs =0,
Unicode message type = 2 esm = 0, dcs =8
WAPPush message type = 3, esm=64,dcs=245
Flash message type = 4 esm = 0, dcs =8
Special character type = 5, esm=0 dcs=0 (160 char message)
Bulk SMS clients may use up to 50 commas (,) separated numbers per HTTP POST – one number per HTTP POST will lead to latency so please use one number per URL only if sending streaming SMS.
How to test the textSMS API URL:
Do the following to ensure your API URL is working when you receive your test account and documentation:
- Open Notepad or any other text editor.
- Edit the URL:
https://username:email@example.com/websms/webmsg?user=&pass=&sid=&mno=&text=&type=&esm=&dcs=with the parameters supplied in order to test the URL in a browser.
- Your URL will look like this:
- Open a browser and copy and paste the above URL with the details you want to send to the browser:
- Check your phone:
- Look in your browser – you will note:
Response ID: 2264874This is a response id linked to the message in our database. You have to keep a record of these response ids in order to query textSMS if errors occur.
The above test confirms that the HTTP API URL is working and you or your programmer may now proceed to set the HTTP API up to work with a programming language of your choice. This will enable you and or your clients to send SMS from your website.
Important note before we proceed:
GSM number format is required to send textSMS: Country code + network prefix + number for example: 076 123 9696 will be: 27761239696. (There may be no zero and no plus sign at the beginning of destination numbers or sender id’s.
Combine the HTTP API URL with a web form and a script to send textSMS:
We will use PHP as a scripting language in our example. We do, however, have sample scripts available for the following scripting languages:
- Visual C#
- Visual Basic
In our example you or your programmer will need three files:
- Web form (HTML file).
- Script file (PHP or any of the above-mentioned scripts).
- Thank you file to redirect to after the textSMS is sent (HTML file or a redirect link).
In this example, we want to set website visitors up to test a specific route before they register for a test account.
We create a simple web form where a user may enter their number to send a test SMS.
The HTML part looks like this:
The second step it to set up the PHP file or script:
Create a thanks.html file or redirect the users to the PHP script to a page you wish, for example, a contact or registration form.
Upload your files to a directory on your server and send a test using the form. That is it!
Our HTTP API allows users to send the following types of textSMS:
- English message 160 characters including punctuation.
- Flash message
- Concatenated Unicode
- Concatenated English message (more than 160 characters – amount of credits used will depend on the number of characters)
- Greek messages
- WAP Push (this is mostly for older handsets. Link Text messaging replaced WAP Push messages)
- Special characters (ÉAUÖUÖOÜìöüòöùéàü'”+!%/=()%26@%3C%3E,;.:$Ł”>&@<>,;.:$Ł) – subject to route support.
- Message status check – response id is required.
- Remaining wallet or credit check.
Your programmer may use different forms and set up different scripts to send the different type of textSMS messages.
Programmers will also be able to build advanced functionality into your site for you.
Contact us to get your test account and HTTP API documentation today!