Danh mục YouTube
curl --request GET \
--url https://api.ayrshare.com/api/post/youTubeCategories/:region \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/post/youTubeCategories/:region', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/post/youTubeCategories/:region"
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/post/youTubeCategories/:region",
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/post/youTubeCategories/:region"
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/post/youTubeCategories/:region")
.header("Authorization", "Bearer <token>")
.asString();{
"region": "US",
"categories": [
{
"id": "1",
"title": "Film & Animation",
"assignable": true
},
{
"id": "10",
"title": "Music",
"assignable": true
},
{
"id": "15",
"title": "Pets & Animals",
"assignable": true
},
{
"id": "17",
"title": "Sports",
"assignable": true
},
{
"id": "18",
"title": "Short Movies",
"assignable": false
},
{
"id": "19",
"title": "Travel & Events",
"assignable": true
},
{
"id": "2",
"title": "Autos & Vehicles",
"assignable": true
},
{
"id": "20",
"title": "Gaming",
"assignable": true
},
{
"id": "21",
"title": "Videoblogging",
"assignable": false
},
{
"id": "22",
"title": "People & Blogs",
"assignable": true
},
{
"id": "23",
"title": "Comedy",
"assignable": true
},
{
"id": "24",
"title": "Entertainment",
"assignable": true
},
{
"id": "25",
"title": "News & Politics",
"assignable": true
},
{
"id": "26",
"title": "Howto & Style",
"assignable": true
},
{
"id": "27",
"title": "Education",
"assignable": true
},
{
"id": "28",
"title": "Science & Technology",
"assignable": true
},
{
"id": "29",
"title": "Nonprofits & Activism",
"assignable": true
},
{
"id": "30",
"title": "Movies",
"assignable": false
},
{
"id": "31",
"title": "Anime/Animation",
"assignable": false
},
{
"id": "32",
"title": "Action/Adventure",
"assignable": false
},
{
"id": "33",
"title": "Classics",
"assignable": false
},
{
"id": "34",
"title": "Comedy",
"assignable": false
},
{
"id": "35",
"title": "Documentary",
"assignable": false
},
{
"id": "36",
"title": "Drama",
"assignable": false
},
{
"id": "37",
"title": "Family",
"assignable": false
},
{
"id": "38",
"title": "Foreign",
"assignable": false
},
{
"id": "39",
"title": "Horror",
"assignable": false
},
{
"id": "40",
"title": "Sci-Fi/Fantasy",
"assignable": false
},
{
"id": "41",
"title": "Thriller",
"assignable": false
},
{
"id": "42",
"title": "Shorts",
"assignable": false
},
{
"id": "43",
"title": "Shows",
"assignable": false
},
{
"id": "44",
"title": "Trailers",
"assignable": false
}
]
}.
.
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
YouTube
Danh mục YouTube
Truy xuất các category id YouTube cho một khu vực nhất định
GET
post
/
youTubeCategories
/
:region
Danh mục YouTube
curl --request GET \
--url https://api.ayrshare.com/api/post/youTubeCategories/:region \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/post/youTubeCategories/:region', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/post/youTubeCategories/:region"
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/post/youTubeCategories/:region",
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/post/youTubeCategories/:region"
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/post/youTubeCategories/:region")
.header("Authorization", "Bearer <token>")
.asString();{
"region": "US",
"categories": [
{
"id": "1",
"title": "Film & Animation",
"assignable": true
},
{
"id": "10",
"title": "Music",
"assignable": true
},
{
"id": "15",
"title": "Pets & Animals",
"assignable": true
},
{
"id": "17",
"title": "Sports",
"assignable": true
},
{
"id": "18",
"title": "Short Movies",
"assignable": false
},
{
"id": "19",
"title": "Travel & Events",
"assignable": true
},
{
"id": "2",
"title": "Autos & Vehicles",
"assignable": true
},
{
"id": "20",
"title": "Gaming",
"assignable": true
},
{
"id": "21",
"title": "Videoblogging",
"assignable": false
},
{
"id": "22",
"title": "People & Blogs",
"assignable": true
},
{
"id": "23",
"title": "Comedy",
"assignable": true
},
{
"id": "24",
"title": "Entertainment",
"assignable": true
},
{
"id": "25",
"title": "News & Politics",
"assignable": true
},
{
"id": "26",
"title": "Howto & Style",
"assignable": true
},
{
"id": "27",
"title": "Education",
"assignable": true
},
{
"id": "28",
"title": "Science & Technology",
"assignable": true
},
{
"id": "29",
"title": "Nonprofits & Activism",
"assignable": true
},
{
"id": "30",
"title": "Movies",
"assignable": false
},
{
"id": "31",
"title": "Anime/Animation",
"assignable": false
},
{
"id": "32",
"title": "Action/Adventure",
"assignable": false
},
{
"id": "33",
"title": "Classics",
"assignable": false
},
{
"id": "34",
"title": "Comedy",
"assignable": false
},
{
"id": "35",
"title": "Documentary",
"assignable": false
},
{
"id": "36",
"title": "Drama",
"assignable": false
},
{
"id": "37",
"title": "Family",
"assignable": false
},
{
"id": "38",
"title": "Foreign",
"assignable": false
},
{
"id": "39",
"title": "Horror",
"assignable": false
},
{
"id": "40",
"title": "Sci-Fi/Fantasy",
"assignable": false
},
{
"id": "41",
"title": "Thriller",
"assignable": false
},
{
"id": "42",
"title": "Shorts",
"assignable": false
},
{
"id": "43",
"title": "Shows",
"assignable": false
},
{
"id": "44",
"title": "Trailers",
"assignable": false
}
]
}.
.
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
Truy xuất các category id YouTube cho một khu vực nhất định. Category ID có thể được đặt trong các endpoint POST hoặc PATCH /post.
Ví dụ,
GET https://api.ayrshare.com/api/youTubeCategories/US cho các danh mục video của U.S.
YouTube chỉ cho phép một số danh mục nhất định được gán bởi người dùng.
Chỉ những danh mục có
assignable là true mới có thể được đặt trong các endpoint POST hoặc PATCH /post khi tạo bài đăng YouTube.Các danh mục khác, không thể gán và có assignable: false, sẽ dẫn đến lỗi.Tham số Header
Tham số Path
Mã quốc gia hai chữ cái của khu vực.
{
"region": "US",
"categories": [
{
"id": "1",
"title": "Film & Animation",
"assignable": true
},
{
"id": "10",
"title": "Music",
"assignable": true
},
{
"id": "15",
"title": "Pets & Animals",
"assignable": true
},
{
"id": "17",
"title": "Sports",
"assignable": true
},
{
"id": "18",
"title": "Short Movies",
"assignable": false
},
{
"id": "19",
"title": "Travel & Events",
"assignable": true
},
{
"id": "2",
"title": "Autos & Vehicles",
"assignable": true
},
{
"id": "20",
"title": "Gaming",
"assignable": true
},
{
"id": "21",
"title": "Videoblogging",
"assignable": false
},
{
"id": "22",
"title": "People & Blogs",
"assignable": true
},
{
"id": "23",
"title": "Comedy",
"assignable": true
},
{
"id": "24",
"title": "Entertainment",
"assignable": true
},
{
"id": "25",
"title": "News & Politics",
"assignable": true
},
{
"id": "26",
"title": "Howto & Style",
"assignable": true
},
{
"id": "27",
"title": "Education",
"assignable": true
},
{
"id": "28",
"title": "Science & Technology",
"assignable": true
},
{
"id": "29",
"title": "Nonprofits & Activism",
"assignable": true
},
{
"id": "30",
"title": "Movies",
"assignable": false
},
{
"id": "31",
"title": "Anime/Animation",
"assignable": false
},
{
"id": "32",
"title": "Action/Adventure",
"assignable": false
},
{
"id": "33",
"title": "Classics",
"assignable": false
},
{
"id": "34",
"title": "Comedy",
"assignable": false
},
{
"id": "35",
"title": "Documentary",
"assignable": false
},
{
"id": "36",
"title": "Drama",
"assignable": false
},
{
"id": "37",
"title": "Family",
"assignable": false
},
{
"id": "38",
"title": "Foreign",
"assignable": false
},
{
"id": "39",
"title": "Horror",
"assignable": false
},
{
"id": "40",
"title": "Sci-Fi/Fantasy",
"assignable": false
},
{
"id": "41",
"title": "Thriller",
"assignable": false
},
{
"id": "42",
"title": "Shorts",
"assignable": false
},
{
"id": "43",
"title": "Shows",
"assignable": false
},
{
"id": "44",
"title": "Trailers",
"assignable": false
}
]
}.
.
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
⌘I
