Get Link
GET
https://api.example.com/api/link/{name}
Requires authentication:
x-api-key: YOUR_API_KEY
Retrieves an existing shortened link by its name or destination URL. The supplied value is matched against both the name and url fields.
Headers
-
x-api-keystring requiredYour API authentication key.Example:YOUR_API_KEY
Path parameters
-
namestring requiredThe name of the shortened link or its complete destination URL.Example:google
Responses
- 200OK
- 404Not Found
Request
curl -X GET 'https://api.example.com/api/link/google' \
-H 'x-api-key: YOUR_API_KEY'
const response = await fetch('https://api.example.com/api/link/google', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY',
},
});
const data = await response.json();
console.log(data);
import requests
response = requests.get(
"https://api.example.com/api/link/google",
headers={
"x-api-key": "YOUR_API_KEY",
},
)
print(response.json())
<?php
$ch = curl_init('https://api.example.com/api/link/google');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'x-api-key: YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
Response
OK
{
"id": 1,
"name": "google",
"url": "https://google.com",
"count": 0,
"creator": "API",
"creatorID": "0",
"createdAt": 1795400000000
}
Not Found
{
"msg": "Link not found from name or url."
}