Instagram オーディオメタデータを取得
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/{audioId} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/{audioId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/media/instagram/audio/{audioId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/media/instagram/audio/{audioId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ayrshare.com/api/media/instagram/audio/{audioId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ayrshare.com/api/media/instagram/audio/{audioId}")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
{
"status": "error",
"code": 517,
"action": "post",
"message": "The selected audio track is unavailable. It may be an invalid audio id, restricted in your region, or not licensed for this use. Please choose a different track using the Instagram audio search endpoint and try again.",
"platform": "instagram"
}
Media
Instagram オーディオメタデータを取得
ID を指定して単一の Instagram オーディオ楽曲の詳細を照会する
GET
/
media
/
instagram
/
audio
/
{audioId}
Instagram オーディオメタデータを取得
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/{audioId} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/{audioId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/media/instagram/audio/{audioId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/media/instagram/audio/{audioId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ayrshare.com/api/media/instagram/audio/{audioId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ayrshare.com/api/media/instagram/audio/{audioId}")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
{
"status": "error",
"code": 517,
"action": "post",
"message": "The selected audio track is unavailable. It may be an invalid audio id, restricted in your region, or not licensed for this use. Please choose a different track using the Instagram audio search endpoint and try again.",
"platform": "instagram"
}
audioId を指定して、1 つのオーディオ楽曲の詳細を取得します。保存済みの ID がまだ有効かを確認したり、公開前に楽曲のタイトルとアートワークを表示したりするために使用します。
ヘッダーパラメータ
パスパラメータ
レスポンスフィールド
楽曲のフィールドは、ネストされるのではなく、レスポンスオブジェクトの直下にフラットに返されます。Instagram はすべての楽曲についてすべてのフィールドを返すとは限らないため、audioId 以外のすべてのフィールドはオプションとして扱ってください。
string
楽曲が見つかった場合は
success。string
楽曲 ID がそのまま返されます。
string
楽曲のタイトル。
string
Instagram が表示するアーティスト名。
integer
楽曲の長さ(ミリ秒)。
string
カバーアートワークのサムネイル URL。
string
music または original_sound のいずれか。boolean
その楽曲を広告で使用できるかどうか。
{
"status": "success",
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
{
"status": "error",
"code": 517,
"action": "post",
"message": "The selected audio track is unavailable. It may be an invalid audio id, restricted in your region, or not licensed for this use. Please choose a different track using the Instagram audio search endpoint and try again.",
"platform": "instagram"
}
利用可否は地域に依存します。 Meta は、存在しない ID、アカウントの地域でライセンスされていない ID、
この用途でライセンスされていない ID に対して同じエラーを返します。3 つのケースはいずれも
517 として
報告されるため、あるアカウントでは解決できる楽曲が、別のアカウントでは正当に失敗することがあります。
保存済みの ID がまだ有効であると想定せず、照会して確認してください。エラー
| Code | 意味 |
|---|---|
| 156 | Instagram がこのプロファイルに連携されていません。 |
| 161 | Instagram の認可が期限切れになったか取り消されました。アカウントを再連携してください。 |
| 239 | アカウントレベルの理由により Instagram がリクエストを拒否しました。 |
| 258 | Instagram が不正な形式のレスポンス、またはマッピングされていない失敗を返しました。 |
| 425 | 接続に必要な Instagram の権限が不足しています。再連携してすべての権限を付与してください。 |
| 435 | Instagram のレート制限に達しました。しばらく待ってから再試行してください。 |
| 514 | Instagram が Instagram Login で連携されています。Audio API には Facebook Login が必要です。 |
| 516 | audioId が欠落しているか空です。 |
| 517 | Instagram が ID を認識しないか、このアカウントではその楽曲を利用できません。 |