मुफ्त शॉर्ट लिंक URL रीडायरेक्शन API
हमारे शक्तिशाली REST API के साथ अपने अनुप्रयोगों में शॉर्ट लिंक URL रीडायरेक्शन को एकीकृत करें। प्रोग्रामेटिक रूप से अपने शॉर्ट लिंक बनाएं, प्रबंधित करें और ट्रैक करें।
100% मुफ्त
बिजली की तेजी
सुरक्षित और विश्वसनीय
त्वरित प्रारंभ
शॉर्ट लिंक बनाएं
curl -X POST https://redirbox.com/create.php \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "targetUrl=https://example.com&shortCode=my-link"
प्रतिक्रिया
{
"success": true,
"message": "Short link created successfully"
}
API एंडपॉइंट
POST
/create.php
Create a new short link redirect.
पैरामीटर
Parameter | Type | Required | Description |
---|---|---|---|
targetUrl |
string | Yes | The destination URL to redirect to |
shortCode |
string | Yes | 3-16 characters, letters, numbers, and hyphens only |
उदाहरण अनुरोध
curl -X POST https://redirbox.com/create.php \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "targetUrl=https://www.google.com&shortCode=google"
सफल प्रतिक्रिया
{
"success": true,
"message": "Short link created successfully"
}
त्रुटि प्रतिक्रिया
{
"success": false,
"message": "Short code already exists. Please choose a different one."
}
कोड उदाहरण
JavaScript (Fetch API)
async function createShortLink(targetUrl, shortCode) {
try {
const response = await fetch('https://redirbox.com/create.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `targetUrl=${encodeURIComponent(targetUrl)}&shortCode=${encodeURIComponent(shortCode)}`
});
const result = await response.json();
if (result.success) {
console.log('Short link created:', `https://redirbox.com/r/${shortCode}`);
} else {
console.error('Error:', result.message);
}
} catch (error) {
console.error('Network error:', error);
}
}
// Usage
createShortLink('https://www.google.com', 'google');
Python (requests)
import requests
def create_short_link(target_url, short_code):
url = 'https://redirbox.com/create.php'
data = {
'targetUrl': target_url,
'shortCode': short_code
}
try:
response = requests.post(url, data=data)
result = response.json()
if result['success']:
print(f"Short link created: https://redirbox.com/r/{short_code}")
else:
print(f"Error: {result['message']}")
except Exception as e:
print(f"Network error: {e}")
# Usage
create_short_link('https://www.google.com', 'google')
PHP (cURL)
<?php
function createShortLink($targetUrl, $shortCode) {
$url = 'https://redirbox.com/create.php';
$data = [
'targetUrl' => $targetUrl,
'shortCode' => $shortCode
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Short link created: https://redirbox.com/r/{$shortCode}\n";
} else {
echo "Error: {$result['message']}\n";
}
}
// Usage
createShortLink('https://www.google.com', 'google');
?>
दर सीमा और दिशानिर्देश
दर सीमा
- 100 requests per day per IP
- Resets daily at midnight
- Fair usage policy applies
सर्वोत्तम अभ्यास
- Use meaningful short codes
- Validate URLs before sending
- Handle errors gracefully
- Cache responses when appropriate
सहायता चाहिए?
हमारा API सरल और विश्वसनीय होने के लिए डिज़ाइन किया गया है। यदि आपके कोई प्रश्न हैं या सहायता की आवश्यकता है, तो हम यहां मदद के लिए हैं!