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
تحديث رابط قصير
تحديث الرابط الوجهة لرابط قصير موجود
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."
}
حدّث الرابط الوجهة لرابط قصير موجود. يُعاد معرّف الرابط القصير عند إنشائه لأول مرة عبر
POST /links.
تخزين معاينات وسائل التواصل الاجتماعي مؤقتًا: تُخزّن منصات التواصل الاجتماعي مؤقتًا بطاقات معاينة Open Graph من الرابط الوجهة الأصلي. بعد تحديث الرابط القصير، قد لا تتطابق بطاقة المعاينة المعروضة على المنصات الاجتماعية مع الوجهة الجديدة حتى تنتهي مدة الذاكرة المؤقتة.
معاملات الترويسة
معاملات المسار
معرّف الرابط القصير المُعاد من
POST /links (مثال: “TkuWEy”).معاملات الجسم
الرابط الوجهة الجديد. يجب أن يكون رابطًا صالحًا يبدأ بـ 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
