Retailer magic: SMS strategies for Winter | On Demand Sign up for our webinar
Retrieve all the Short URL’s you have created.
/shorturl
There are no required
properties for this API, only optional
.
Attribute | Type | Description | Default |
---|---|---|---|
method | string | The type of Short URL created. Must be either simple or tracked. | both |
start | datetime, string | The oldest date of Short URL’s created that you want to retrieve. Formats: UNIX: A UNIX timestamp (e.g. 1537525884 )ISO 8601: A string format including the time and timezone (e.g. 2018-02-22T09:03:00+00:00 )Human Readable: A human readable way to write the date or time you want to sent the message at (e.g. 25th December 2019 21:00 , 2 weeks , august 20 , may 11 2019 , last friday of march 2019 , next saturday ). | NOW() |
end | datetime,string | The newest date of Short URL’s created that you want to retrieve. Formats: UNIX: A UNIX timestamp (e.g. 1537525884 )ISO 8601: A string format including the time and timezone (e.g. 2018-02-22T09:03:00+00:00 )Human Readable: A human readable way to write the date or time you want to sent the message at (e.g. 25th December 2019 21:00 , 2 weeks , august 20 , may 11 2019 , last friday of march 2019 , next saturday ). | |
sort | string | Sort the response by ID in ASC or DESC order. | DESC |
skip | int | Where to start the returned results. | 0 |
limit | int | Where to end the returned results. Limit: 1000 | 25 |
Code Example
cURL
curl https://api.voodoosms.com/shorturl \
-H "Authorization: Bearer {key}"
PHP
<?php
$api_key = 'API KEY';
$ch = curl_init('https://api.voodoosms.com/shorturl');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Response
{
"count": 1,
"url": {
"id": 5123,
"name": "Pizza Shop",
"link": "http://vsms.co/5hG",
"destination": "https://website.pizza",
"method": "simple",
"websms_name": "My SMS Campaign",
"clicks" {
"total": 23,
"last_click": 1546378474,
"last_used": 1546378474
},
"created_at": 1547587700,
"updated_at": 1534865678
}
}
Code | Message | Meaning |
---|---|---|
56 | No Short URL’s created | You have no Short URL’s attached to your account. |
57 | Invalid method | Method invalid. Allowed methods: simple , tracked . |
Error Response
{
"error": {
"code": 56,
"msg": "No Short URL's created"
}
}
Allows you to create a new Short URL and select between simple and tracked URL.
/shorturl
There are no optional
properties for this API, only required
.
Attribute | Type | Description |
---|---|---|
name | string | A name to recognise the Short URL. |
url | string | The URL you want to redirect to. |
method | string | The type of Short URL. Accepted values: simple or tracked . |
Code Example
cURL
curl -X POST https://api.voodoosms.com/shorturl \
-H "Authorization: Bearer {key}" \
-d '{
"name": "Pizza Shop",
"url": "https://pizzashop.com",
"method": "tracked"
}'
PHP
<?php
$api_key = 'API KEY';
$msg = json_encode(
[
"name" => "Pizza Shop",
"url" => "https://pizzashop.com",
"method" => "tracked"
]
);
$ch = curl_init('https://api.voodoosms.com/shorturl');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Response
{
"id": 2354,
"status": "SUCCESS",
"data": {
"name": "Pizza Shop",
"url": "https://pizzashop.com",
"method": "tracked",
"short_url": "http://vsms.co/5hG"
},
"created_at": 1547683200
}
Code | Message | Meaning |
---|---|---|
57 | Invalid method | The method chosen is invalid. Accepted values: simple , tracked . |
58 | Invalid name | The name must only be alphanumeric and not exceed 32 characters. |
59 | Invalid URL | Not a valid URL. Must start with http or https or the URL check failed. |
61 | Short URL creation has failed | Creating the Short URL has failed. Contact your account manager. |
Error Response
{
"error": {
"code": 59,
"msg": "Invalid URL"
}
}
Update Short URL’s name or URL itself.
/shorturl/:id
There are no optional
properties for this API, only required
.
Attribute | Type | Description |
---|---|---|
name | string | The name of the Short URL. |
url | string | The URL the Short URL redirects to. Must start with http or https . |
Code Example
cURL
curl -X PUT https://api.voodoosms.com/shorturl/2354 \
-H "Authorization: Bearer {key}"
-d '{
"name": "Burger Shop",
"url": "https://burger-shop.com"
}'
PHP
<?php
$api_key = 'API KEY';
$msg = json_encode(
[
'name' => 'Burger Shop',
'url' => 'https://burger-shop.com'
]
);
$ch = curl_init('https://api.voodoosms.com/shorturl/2354');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Response
{
"status": "SUCCESS",
"name": "Burger Shop",
"url": "https://burger-shop.com",
"short_url": "http://vsms.co/5hG"
}
Code | Message | Meaning |
---|---|---|
23 | Invalid ID | This Short URL does not belong to your account. |
58 | Invalid name | The name must only be alphanumeric. |
59 | Invalid URL | Not a valid URL. Must start with http or https or the URL check failed. |
Error Response
{
"error": {
"code": 58,
"msg": "Invalid name"
}
}
Delete a Short URL by using unique ID.
/shorturl/:id
Code Example
cURL
curl -X DELETE https://api.voodoosms.com/shorturl/2354 \
-H "Authorization: Beader {key}"
PHP
<?php
$api_key = 'API KEY';
$ch = curl_init('https://api.voodoosms.com/shorturl/2354');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Response
{
"status": "SUCCESS",
"message": "Short URL has been deleted"
}
Code | Message | Meaning |
---|---|---|
23 | Invalid ID | The ID does not match to any of your Short URL. |
Error Response
{
"error": {
"code": 23,
"msg": "Invalid ID"
}
}