curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mediaUrl": "https://img.ayrshare.com/012/vid.mp4"}' \
-X POST https://api.ayrshare.com/api/media/urlExists
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/media/urlExists", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrl: "https://img.ayrshare.com/012/vid.mp4"
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'mediaUrl': 'https://img.ayrshare.com/012/vid.mp4'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/media/urlExists',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/media/urlExists',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'mediaUrl' => 'https://img.ayrshare.com/012/vid.mp4'
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"statusCode": 200,
"contentType": "image/jpeg"
}
{
"status": "error",
"statusCode": 404,
"statusText": "Not Found"
}
Media
驗證媒體 URL 是否存在
驗證媒體檔案是否存在
POST
/
media
/
urlExists
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mediaUrl": "https://img.ayrshare.com/012/vid.mp4"}' \
-X POST https://api.ayrshare.com/api/media/urlExists
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/media/urlExists", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrl: "https://img.ayrshare.com/012/vid.mp4"
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'mediaUrl': 'https://img.ayrshare.com/012/vid.mp4'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/media/urlExists',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/media/urlExists',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'mediaUrl' => 'https://img.ayrshare.com/012/vid.mp4'
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"statusCode": 200,
"contentType": "image/jpeg"
}
{
"status": "error",
"statusCode": 404,
"statusText": "Not Found"
}
驗證上傳後的媒體檔案是否存在。應該與 /media/uploadUrl 端點搭配使用。
標頭參數
驗證媒體 URL 是否存在
POST https://api.ayrshare.com/api/media/urlExists
驗證上傳後的媒體檔案是否存在。應該與 /media/uploadUrl 端點搭配使用。
您也會收到該媒體檔案的 contentType。
會對媒體 URL 發出一個 HEAD 請求來驗證檔案是否存在。
請確定託管服務提供者沒有封鎖 HEAD 請求。
主體參數
要驗證是否存在的媒體 URL。
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mediaUrl": "https://img.ayrshare.com/012/vid.mp4"}' \
-X POST https://api.ayrshare.com/api/media/urlExists
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/media/urlExists", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrl: "https://img.ayrshare.com/012/vid.mp4"
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'mediaUrl': 'https://img.ayrshare.com/012/vid.mp4'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/media/urlExists',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/media/urlExists',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'mediaUrl' => 'https://img.ayrshare.com/012/vid.mp4'
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
{
"status": "success",
"statusCode": 200,
"contentType": "image/jpeg"
}
{
"status": "error",
"statusCode": 404,
"statusText": "Not Found"
}
⌘I
