Edit Link
Added in v1.0
PATCH
https://api.example.com/api/linkRequires authentication: x-api-key: YOUR_API_KEY
Updates the name and destination URL of an existing shortened link. The link ID, new name and new destination URL must be supplied in the request body.
Headers
x-api-keystringrequiredYour API authentication key.Content-TypestringrequiredMust beapplication/json.
Body parameters
idintegerrequiredThe database ID of the shortened link to update.namestringrequiredThe new name for the shortened link.urlstringrequiredThe new destination URL.
Responses
- 200OK
- 404Not Found
- 409Conflict
Request
curl -X PATCH 'https://api.example.com/api/link' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"id": 123,
"name": "example",
"url": "https://example.com"
}'
const res = await fetch('https://api.example.com/api/link', {
method: 'PATCH',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ id: 123, name: 'example', url: 'https://example.com' })
});
const link = await res.json();
import requests
res = requests.patch(
'https://api.example.com/api/link',
headers={'x-api-key': 'YOUR_API_KEY'},
json={'id': 123, 'name': 'example', 'url': 'https://example.com'}
)
link = res.json()
$ch = curl_init('https://api.example.com/api/link');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'id' => 123,
'name' => 'example',
'url' => 'https://example.com'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$link = json_decode(curl_exec($ch), true);
200 OK
{
"id": 1,
"name": "example",
"url": "https://example.com",
"count": 0,
"creator": "API",
"creatorID": "0",
"createdAt": 1795400000000
}
404 Not Found
{
"msg": "That link no longer exists."
}
409 Conflict
{
"msg": "A link with that name already exists."
}
Discussion 0
Reading is open to everyone. Posting, replying, reacting and reporting require a Discord account — we only receive your public username and avatar.
No comments yet. Sign in with Discord to start the conversation.
Sign in required
Reading is open to everyone. Posting, replying, reacting and reporting require a Discord account — we only receive your public username and avatar.