Short Links
Trackable short links.
1
GET List Short Links
GET https://api.greenbubble.io/api/short-links
cURL
curl -X GET 'https://api.greenbubble.io/api/short-links' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/short-links', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/short-links"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/short-links');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
2
GET Get Short Link
GET https://api.greenbubble.io/api/short-links/SHORT_LINK_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/short-links/SHORT_LINK_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/short-links/SHORT_LINK_ID', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/short-links/SHORT_LINK_ID"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/short-links/SHORT_LINK_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
3
POST Create Short Link
POST https://api.greenbubble.io/api/short-links
cURL
curl -X POST 'https://api.greenbubble.io/api/short-links' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"original_url":"https://example.com/long"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/short-links', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"original_url": "https://example.com/long"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/short-links"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"original_url": "https://example.com/long"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/short-links');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"original_url":"https://example.com/long"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
4
PUT Update Short Link
PUT https://api.greenbubble.io/api/short-links/SHORT_LINK_ID
cURL
curl -X PUT 'https://api.greenbubble.io/api/short-links/SHORT_LINK_ID' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/short-links/SHORT_LINK_ID', {
method: 'PUT',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/short-links/SHORT_LINK_ID"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {}
response = requests.put(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/short-links/SHORT_LINK_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
5
POST Bulk Delete Short Links
POST https://api.greenbubble.io/api/short-links/bulk-delete
cURL
curl -X POST 'https://api.greenbubble.io/api/short-links/bulk-delete' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"ids":["SHORT_LINK_ID"]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/short-links/bulk-delete', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"ids": [
"SHORT_LINK_ID"
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/short-links/bulk-delete"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"ids": [
"SHORT_LINK_ID"
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/short-links/bulk-delete');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"ids":["SHORT_LINK_ID"]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;