curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.new-destination.com"}' \
-X PUT https://api.ayrshare.com/api/links/TkuWEy
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/links/TkuWEy", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://www.new-destination.com", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://www.new-destination.com'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.put('https://api.ayrshare.com/api/links/TkuWEy',
json=payload,
headers=headers)
print(r.json())
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'PUT',
'https://api.ayrshare.com/api/links/TkuWEy',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'url' => 'https://www.new-destination.com',
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"id": "TkuWEy",
"originalUrl": "https://www.new-destination.com",
"shortUrl": "https://ayrs.io/TkuWEy",
"created": "2023-07-17T15:20:51.118Z",
"updated": "2024-01-10T12:30:00.000Z"
}
{
"action": "request",
"status": "error",
"code": 126,
"message": "Shorten URL failed. Please verify the URL is properly formatted and the correct UTM parameters are used."
}
{
"action": "link",
"status": "error",
"code": 418,
"message": "Link not found or not owned by user."
}
Links
Cập nhật Short Link
Cập nhật URL đích của một short link đã tồn tại
PUT
/
links
/
:id
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.new-destination.com"}' \
-X PUT https://api.ayrshare.com/api/links/TkuWEy
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/links/TkuWEy", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://www.new-destination.com", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://www.new-destination.com'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.put('https://api.ayrshare.com/api/links/TkuWEy',
json=payload,
headers=headers)
print(r.json())
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'PUT',
'https://api.ayrshare.com/api/links/TkuWEy',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'url' => 'https://www.new-destination.com',
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"id": "TkuWEy",
"originalUrl": "https://www.new-destination.com",
"shortUrl": "https://ayrs.io/TkuWEy",
"created": "2023-07-17T15:20:51.118Z",
"updated": "2024-01-10T12:30:00.000Z"
}
{
"action": "request",
"status": "error",
"code": 126,
"message": "Shorten URL failed. Please verify the URL is properly formatted and the correct UTM parameters are used."
}
{
"action": "link",
"status": "error",
"code": 418,
"message": "Link not found or not owned by user."
}
Cập nhật URL đích của một short link đã tồn tại. ID của short link được trả về khi bạn tạo short link lần đầu tiên qua
POST /links.
Bộ nhớ đệm Preview mạng xã hội: Các nền tảng mạng xã hội lưu bộ nhớ đệm các thẻ preview Open Graph từ URL đích ban đầu. Sau khi cập nhật một short link, thẻ preview hiển thị trên các nền tảng mạng xã hội có thể không khớp với đích mới cho đến khi bộ nhớ đệm hết hạn.
Header Parameters
Path Parameters
ID của short link được trả về từ
POST /links (ví dụ: “TkuWEy”).Body Parameters
URL đích mới. Phải là một URL hợp lệ bắt đầu bằng https://
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.new-destination.com"}' \
-X PUT https://api.ayrshare.com/api/links/TkuWEy
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/links/TkuWEy", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://www.new-destination.com", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://www.new-destination.com'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.put('https://api.ayrshare.com/api/links/TkuWEy',
json=payload,
headers=headers)
print(r.json())
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'PUT',
'https://api.ayrshare.com/api/links/TkuWEy',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'url' => 'https://www.new-destination.com',
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"id": "TkuWEy",
"originalUrl": "https://www.new-destination.com",
"shortUrl": "https://ayrs.io/TkuWEy",
"created": "2023-07-17T15:20:51.118Z",
"updated": "2024-01-10T12:30:00.000Z"
}
{
"action": "request",
"status": "error",
"code": 126,
"message": "Shorten URL failed. Please verify the URL is properly formatted and the correct UTM parameters are used."
}
{
"action": "link",
"status": "error",
"code": 418,
"message": "Link not found or not owned by user."
}
⌘I
