Text CALL to 88440
info@voodooSMS.com

+44 (0)1484 599 311

Login Free Account

Developer Tools

Free Account
Our new API is live!

Our new API is now available to use. We have improved the methods that you are familiar with, offering you a clearer understanding of what each property can do and a more detailed response from each call.

The old API is still fully functioning and support for this will not end.

We are also introducing API Keys which are used to access the API methods and improve the security around using the API.

Click here to see the new Developer page.

Click here to read our new Developer Documentation.

SHORT URL

Create, update and delete Short URL’s from your account.

Definition

http:// or https:// www.voodooSMS.com/vapi/server/short_url

METHODS

GET

POST

Parameters

Required Fields

uid:

System allocated username for API user configured within the VoodooSMS.com Portal in ‘Send SMS>API Management’

pass:

System password for API user configured within the VoodooSMS.com Portal in ‘Send SMS>API Management’

file:

An external file URL

Extensions: CSV, XLS, XLSX, PDF, Doc, DocX, TXT, JPG, JPEG, PNG
Size: Less than 10MB.

expiry:

How long the file will be valid for

Example: 1h (1 hour) | 4w (4 weeks)
Valid formats: s = seconds | m = minutes | h = hour | d = day | w = week.

method:

How to handle your Short URL

Options: add | update | delete

suid:

This is only used in conjunction with the update and delete methods

The ID of your Short URL. This is generated with the add method.

Optional Parameters

format:

The format you wish the return status to be in

Default: XML
Options: XML | JSON

Single textual message to single destinations

Request


<?php
switch($_SERVER["REQUEST_METHOD"]) {
    case "GET":
        $uid = htmlspecialchars($_GET["uid"]);
        $pass = htmlspecialchars($_GET["pass"]);
        $file = htmlspecialchars($_GET["file"]);
        $expiry = htmlspecialchars($_GET["expiry"]);
        $method = htmlspecialchars($_GET["method"]);
        $suid = htmlspecialchars($_GET["suid"]);
        break;
    case "POST":
        $uid = htmlspecialchars($_POST["uid"]);
        $pass = htmlspecialchars($_POST["pass"]);
        $file = htmlspecialchars($_POST["file"]);
        $expiry = htmlspecialchars($_POST["expiry"]);
        $method= htmlspecialchars($_POST["method"]);
        $suid = htmlspecialchars($_POST["suid"]);
        break;
}

$url = 'https://www.voodoosms.com/vapi/server/shortURL?uid='.$uid.'&pass='.$pass.
        '&file='.$file.'&expiry='.$expiry."&method=".$method."&suid=".$suid;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// Download the given URL, and return output
$output = curl_exec($ch);
echo $output . "   " . curl_error($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
?>

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Servlet extends HttpServlet {
    public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {

        if(request.getAttribute("uid") != null && request.getAttribute("pass") != null
            && request.getAttribute("file") != null && request.getAttribute("expiry") != null
            && request.getAttribute("method") != null && request.getAttribute("suid") != null)
        {
            String charset = "UTF-8";
            String query = String.format("uid=%s&pass=%s&file=%s&expiry=%s&method=%s&suid=%s",
             URLEncoder.encode(request.getAttribute("uid").toString(), charset),
             URLEncoder.encode(request.getAttribute("pass").toString(), charset),
             URLEncoder.encode(request.getAttribute("file").toString(), charset),
             URLEncoder.encode(request.getAttribute("expiry").toString(), charset),
             URLEncoder.encode(request.getAttribute("method").toString(), charset),
             URLEncoder.encode(request.getAttribute("suid").toString(), charset));
            String url = "www.voodoosms.com/vapi/server/shortURL";

            URLConnection connection = new URL(url + "?" + query).openConnection();
            connection.setRequestProperty("Accept-Charset", charset);
            InputStream reqres = connection.getInputStream();
            // reqres contains the request output
        }
        else {
        	// Wrong parameters
        }
    }
    public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
    	// Same as GET
    }
}

var http = require('http');
var https = require('https');
var querystring = require('querystring');
var url = require('url');

var server = http.createServer(function(req, res) {

    var url_parts = url.parse(req.url, true);
    var query = url_parts.query;
    var uid = query.uid;
    var pass = query.pass;
    var file = query.file;
    var expiry = query.expiry;
    var method = query.method;
    var suid = query.suid;

    if(uid && pass && file && expiry && method && suid) {
        var get_data = querystring.stringify({
          "uid" : uid, "pass": pass, "file": file, "expiry": expiry, "method" : method, "suid" : suid
        });

        var options = {
            host: 'www.voodoosms.com',
            path: '/vapi/server/shortURL?' + get_data
        }

        https.get(options, function(reqres) {
          reqres.on('data', function(chunk) {
            res.end(chunk);
          })
        });

    }
    else
      res.end("Wrong parameters");
});

server.listen(8080);

require 'net/http'
require 'json'

class Controller < ApplicationController
    def index
    uid = params[:uid]
    pass = params[:pass]
    file = params[:file]
    expiry = params[:expiry]
    method = params[:method]
    suid = params[:suid]

    if uid and pass and file and expiry and method and suid
        uri = "?uid=" + uid + "&pass=" + pass + "&file=" + file + "&expiry=" + expiry + "&method=" + method
        + "&suid=" + suid
    else
        uri = 0
    end

    if uri != 0
        url = URI.parse('http://www.voodoosms.com/vapi/server/shortURL' + uri)
        uri = URI(url)
        response = Net::HTTP.get(uri)
        @res = response
    else
        @res = "Wrong parameters"
    end
  end
end

from django.http
import HttpResponse, HttpRequest
import urllib2

def index(request):

    if request.method == 'GET':
        uid = request.GET.get('uid', '')
        pas = request.GET.get('pass', '')
        file = request.GET.get('file', '')
        expiry = request.GET.get('expiry', '')
        method = request.GET.get('method', '')
        suid = request.GET.get('suid', '')
    elif request.method == 'POST':
        uid = request.POST.get('uid', '')
        pas = request.POST.get('pass', '')
        file = request.POST.get('file', '')
        expiry = request.POST.get('expiry', '')
        method = request.POST.get('method', '')
        suid = request.POST.get('suid', '')

    if uid and pas and file and expiry and method and suid :
        u = "?uid=%s&pass=%s&file=%s&expiry=%s&method=%s&suid=%s" % (uid, pas, file, expiry, method, suid)
    else :
        u = 0

    if u :
        res = urllib2.urlopen("https://voodoosms.com/vapi/server/shortURL" + u).read()
        return HttpResponse(res)
    else :
        return HttpResponse("Wrong parameters")

using System;
using System.Net.Http;
using System.Web;

var client = new HttpClient();

//Get the parameters, either GET or POST request
    string uid = HttpContext.Current.Server.HtmlEncode(Request["uid"]);
    string pass = HttpContext.Current.Server.HtmlEncode(Request["pass"]);
    string file = HttpContext.Current.Server.HtmlEncode(Request["file"]);
    string expiry = HttpContext.Current.Server.HtmlEncode(Request["expiry"]);
    string method = HttpContext.Current.Server.HtmlEncode(Request["method"]);
    string suid = HttpContext.Current.Server.HtmlEncode(Request["suid"]);

//Exit if one or more parameters is missing
    if(String.IsNullOrEmpty(uid) || String.IsNullOrEmpty(pass) || String.IsNullOrEmpty(file)
    || String.IsNullOrEmpty(expiry)|| String.IsNullOrEmpty(method)|| String.IsNullOrEmpty(suid)
    System.Environment.Exit(1);

// Send the async request
    HttpResponseMessage response = await client.GetAsync(
    "https://www.voodoosms.com/vapi/server/shortURL?uid=" + uid + "&pass="
    + pass + "&file=" + file + "&expiry=" + expiry + "&method=" + method
    + "&suid=" + suid);

// Get the response content
HttpContent responseContent = response.Content;

// Get the stream of the content and write the output
using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
{
    Console.WriteLine(await reader.ReadToEndAsync());
}

Response


<xml>
   <result>200</result>
   <resultText>Short URL generated Successfully</resultText>
   <name />
   <shortUrlid>413</shortUrlid>
   <shortUrl>vsms.co/54b</shortUrl>
   <expires>5m</expires>
</xml>

{
	"expires": "5m",
	"name": "",
	"result": 200,
	"resultText": "Short URL generated Successfully",
	"shortUrl": "vsms.co/54b",
	"shortUrlid": 413
}

On success, the response header HTTP status code will be 200 OK confirming that the message is sent. If you try to send message without authorisation you an error code of 401 Unauthorized will be received.

SMSResponseDetails

Response Code

Code Type Response
200 int OK
400 int Required parameters are missing
400 int Invalid file. You have given an invalid file extension. See documentation for valid extensions.
400 int Invalid expiry format. See documentation for valid formats.
400 int Expiry date cannot exceed 31 days.
400 int Invalid file. File cannot be validated, it may not be available.
400 int Invalid file. File size is greater than 10MB
400 int Short URL could not be updated. Please try again, or contact support@voodoosms.com
400 int There was a problem processing your link. Please try again, or contact support@voodoosms.com
400 int Short URL could not be deleted. Please try again, or contact support@voodoosms.com
400 int Invalid method. Use 'add, update or delete'
401 int Your API credentials are invalid
{
    "requestError": {
        "serviceException": {
            "messageId": "UNAUTHORIZED",
            "text": "Invalid login details"
        }
    }
}
METHOD POST
Request Headers
Accept: */*
Referer: http:// or https:// www.voodoosms.com/vapi/server
authorization: Basic ZGZkZjpzZGZkZg==
accept-encoding: gzip, deflate
content-type: application/json
content-length: 64
URL http:// or https:// www.voodoosms.com/vapi/server/sendSMS
Request Data
{
    "from": "447711112244",
    "to": [
        "447788112233"
    ],
    "text": "tsdsdsd"
}
Status
Response Headers
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, UNLINK,
PURGE access-control-allow-headers: Authorization, Content-Type, X-Enrollment-Token
content-type: application/json;charset=UTF-8
content-length: 97
date: Tue, 27 Dec 2016 08:17:07 GMT
connection: close
server: SMS API
strict-transport-security: max-age=16000000; includeSubDomains; preload;