Short URL

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

Definition

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

Methods

GET

Required Parameters

uid: System allocated username for API user configured within the VoodooSMS.com Portal in Send SMS>API SMS>HTTP API.
pass: System password for API user configured within the VoodooSMS.com Portal in Send SMS>API SMS>HTTP API.
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)
Valid formats: s = seconds * | * m = minutes * | * h = hour * | * d = day * | * w = week.
method: How to handle your Short URL.
Options: add
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);
?>
Response
<xml>
   <result>200</result>
   <resultText>Short URL generated Successfully</resultText>
   <name />
   <shortUrlid>413</shortUrlid>
   <shortUrl>vsms.co/54b</shortUrl>
   <expires>5m</expires>
</xml>

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

SMS Response Details

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.