批量获取全部
curl --request GET \
--url https://api.ayrshare.com/api/user/batch \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/user/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/user/batch"
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/user/batch",
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/user/batch"
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/user/batch")
.header("Authorization", "Bearer <token>")
.asString();{
"success": true,
"url": "https://storage.googleapis.com/batch.ayrshare.com/users/9iskiedwtOddd/users-batch-2024-01-11-22-42.json",
"urlAvailable": "2024-01-11T22:47:36Z",
"urlExpires": "2024-01-18T22:42:36Z",
"lastUpdated": "2024-01-11T22:42:36.808Z",
"nextUpdate": "2024-01-11T22:54:36.808Z"
}
{
"action": "authorization",
"status": "error",
"code": 102,
"message": "API Key not valid. Please be sure to send a Header Authorization containing 'Bearer API_KEY'. .../ayrshare.com/rest-api/overview#authorization"
}
User
批量获取全部
检索所有 user profile 的用户数据
GET
/
user
/
batch
批量获取全部
curl --request GET \
--url https://api.ayrshare.com/api/user/batch \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/user/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/user/batch"
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/user/batch",
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/user/batch"
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/user/batch")
.header("Authorization", "Bearer <token>")
.asString();{
"success": true,
"url": "https://storage.googleapis.com/batch.ayrshare.com/users/9iskiedwtOddd/users-batch-2024-01-11-22-42.json",
"urlAvailable": "2024-01-11T22:47:36Z",
"urlExpires": "2024-01-18T22:42:36Z",
"lastUpdated": "2024-01-11T22:42:36.808Z",
"nextUpdate": "2024-01-11T22:54:36.808Z"
}
{
"action": "authorization",
"status": "error",
"code": 102,
"message": "API Key not valid. Please be sure to send a Header Authorization containing 'Bearer API_KEY'. .../ayrshare.com/rest-api/overview#authorization"
}
检索所有 user profile 的用户数据。当你需要为大量用户快速依次调用 /user 端点时,可以使用批量端点作为替代方案,以避免受速率限制的影响。
该端点会返回一个包含所有 user profile 数据的文件的预签名 URL。请注意
urlAvailable 字段中给出的时间,即该文件可访问的时间。
预签名 URL 会在创建后 7 天内过期。新文件可能每 3 小时生成一次。
你也可以通过 Batch Action webhook 在文件准备就绪时收到通知。
Header 参数
{
"success": true,
"url": "https://storage.googleapis.com/batch.ayrshare.com/users/9iskiedwtOddd/users-batch-2024-01-11-22-42.json",
"urlAvailable": "2024-01-11T22:47:36Z",
"urlExpires": "2024-01-18T22:42:36Z",
"lastUpdated": "2024-01-11T22:42:36.808Z",
"nextUpdate": "2024-01-11T22:54:36.808Z"
}
{
"action": "authorization",
"status": "error",
"code": 102,
"message": "API Key not valid. Please be sure to send a Header Authorization containing 'Bearer API_KEY'. .../ayrshare.com/rest-api/overview#authorization"
}
⌘I
