Instagram オーディオを検索
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/search \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/search', 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/search"
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/search",
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/search"
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/search")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
Media
Instagram オーディオを検索
Reel に添付する楽曲を Instagram のライセンス済みオーディオカタログから検索する
GET
/
media
/
instagram
/
audio
/
search
Instagram オーディオを検索
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/search \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/search', 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/search"
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/search",
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/search"
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/search")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
キーワードで Instagram のオーディオカタログを検索します。返された
コード 514 から 518 については Instagram Reels オーディオエラー で説明されています。その他については Ayrshare エラーリファレンス を参照してください。
audioId を instagramOptions.audioConfiguration で使用すると、Reel の公開時にその楽曲を添付できます。
ヘッダーパラメータ
クエリパラメータ
string
必須
アーティスト名や楽曲名などの検索キーワード。空の値や空白のみの値は
code: 101 を返します。string
デフォルト:"music"
検索対象のカタログ。ライセンスされた商用楽曲は
music、他のクリエイターの Reels から取得されたオーディオは
original_sound を指定します。それ以外の値は code: 101 を返します。integer
返される楽曲の最大数で、
1 から 100 までです。整数でない値や範囲外の値は code: 101 を返します。
省略した場合は、Instagram 自身のデフォルトが適用されます。レスポンスフィールド
Instagram はすべての楽曲についてすべてのフィールドを返すとは限らないため、audioId 以外のすべての楽曲フィールドはオプションとして扱ってください。
string
検索が完了した場合は
success。カタログに一致がない場合も成功として扱われます。string
検索されたキーワードがそのまま返されます。
array
一致した楽曲。空の配列は、検索は実行されたものの何も一致しなかったことを意味します。
{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
エラー
| Code | 意味 |
|---|---|
| 101 | query の欠落または空、認識されない audioType、または 1 から 100 の範囲外の limit。 |
| 156 | Instagram がこのプロファイルに連携されていません。 |
| 161 | Instagram の認可が期限切れになったか取り消されました。アカウントを再連携してください。 |
| 239 | 利用できない楽曲を含む、アカウントレベルの理由により Instagram がリクエストを拒否しました。検索では、照会エンドポイントが返す 517 ではなく 239 が報告されます。 |
| 258 | Instagram が不正な形式のレスポンス、またはマッピングされていない失敗を返しました。 |
| 425 | 接続に必要な Instagram の権限が不足しています。再連携してすべての権限を付与してください。 |
| 435 | Instagram のレート制限に達しました。しばらく待ってから再試行してください。 |
| 514 | Instagram が Instagram Login で連携されています。Audio API には Facebook Login が必要です。 |