curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-H "X-Twitter-OAuth1-Api-Key: YOUR_CONSUMER_KEY" \
-H "X-Twitter-OAuth1-Api-Secret: YOUR_CONSUMER_SECRET" \
-d '{"profileKey": "PROFILE_KEY"}' \
-X POST https://api.ayrshare.com/api/profiles/generateJWT
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
fetch("https://api.ayrshare.com/api/profiles/generateJWT", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`,
"X-Twitter-OAuth1-Api-Key": "YOUR_CONSUMER_KEY",
"X-Twitter-OAuth1-Api-Secret": "YOUR_CONSUMER_SECRET"
},
body: JSON.stringify({
profileKey: PROFILE_KEY, // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'profileKey': 'PROFILE_KEY'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY',
'X-Twitter-OAuth1-Api-Key': 'YOUR_CONSUMER_KEY',
'X-Twitter-OAuth1-Api-Secret': 'YOUR_CONSUMER_SECRET'}
r = requests.post('https://api.ayrshare.com/api/profiles/generateJWT',
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/post',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'profileKey' => 'PROFILE_KEY', // required
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace GenerateJWTRequest_csharp
{
class GenerateJWT
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles/generateJWT";
try
{
var sendData = new
{
profileKey = "PROFILE_KEY"
};
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
string jsonData = JsonConvert.SerializeObject(sendData);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
catch (Exception e)
{
Console.WriteLine($"Unexpected error: {e.Message}");
}
}
}
}
{
"status": "success",
"title": "User Profile Title",
"token": "ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu",
"url": "https://profile.ayrshare.com?session=ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu&domain=PROVIDED_DOMAIN",
"emailSent": true,
"expiresIn": "5m"
}
{
"action": "JWT",
"status": "error",
"code": 189,
"message": "Error generating JWT. Check the sent parameters.",
"details": "Missing or incorrect domain."
}
{
"action": "JWT",
"status": "error",
"code": 188,
"message": "Both twitterApiKey and twitterApiSecret are required. You provided only one."
}
{
"action": "JWT",
"status": "error",
"code": 434,
"message": "X/Twitter API credentials were provided in both the request headers and the request body. Please use the headers only. See https://www.ayrshare.com/docs/apis/profiles/generate-jwt"
}
Profiles
إنشاء رابط ربط (generateJWT)
أنشئ رابط ربط للشبكات الاجتماعية لملف مستخدم عبر نقطة النهاية generateJWT.
POST
/
profiles
/
generateJWT
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-H "X-Twitter-OAuth1-Api-Key: YOUR_CONSUMER_KEY" \
-H "X-Twitter-OAuth1-Api-Secret: YOUR_CONSUMER_SECRET" \
-d '{"profileKey": "PROFILE_KEY"}' \
-X POST https://api.ayrshare.com/api/profiles/generateJWT
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
fetch("https://api.ayrshare.com/api/profiles/generateJWT", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`,
"X-Twitter-OAuth1-Api-Key": "YOUR_CONSUMER_KEY",
"X-Twitter-OAuth1-Api-Secret": "YOUR_CONSUMER_SECRET"
},
body: JSON.stringify({
profileKey: PROFILE_KEY, // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'profileKey': 'PROFILE_KEY'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY',
'X-Twitter-OAuth1-Api-Key': 'YOUR_CONSUMER_KEY',
'X-Twitter-OAuth1-Api-Secret': 'YOUR_CONSUMER_SECRET'}
r = requests.post('https://api.ayrshare.com/api/profiles/generateJWT',
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/post',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'profileKey' => 'PROFILE_KEY', // required
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace GenerateJWTRequest_csharp
{
class GenerateJWT
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles/generateJWT";
try
{
var sendData = new
{
profileKey = "PROFILE_KEY"
};
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
string jsonData = JsonConvert.SerializeObject(sendData);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
catch (Exception e)
{
Console.WriteLine($"Unexpected error: {e.Message}");
}
}
}
}
{
"status": "success",
"title": "User Profile Title",
"token": "ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu",
"url": "https://profile.ayrshare.com?session=ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu&domain=PROVIDED_DOMAIN",
"emailSent": true,
"expiresIn": "5m"
}
{
"action": "JWT",
"status": "error",
"code": 189,
"message": "Error generating JWT. Check the sent parameters.",
"details": "Missing or incorrect domain."
}
{
"action": "JWT",
"status": "error",
"code": 188,
"message": "Both twitterApiKey and twitterApiSecret are required. You provided only one."
}
{
"action": "JWT",
"status": "error",
"code": 434,
"message": "X/Twitter API credentials were provided in both the request headers and the request body. Please use the headers only. See https://www.ayrshare.com/docs/apis/profiles/generate-jwt"
}
أنشئ رابط ربط للشبكات الاجتماعية لملف مستخدم. لا يزال اسم نقطة النهاية
generateJWT، لكن التوكن الذي تُعيده معتّم وليس JWT.
انظر نظرة عامة على رابط الربط لمزيد من التفاصيل.
رابط الربط صالح لمدة 5 دقائق. بعد 5 دقائق يجب توليد رابط الربط جديد.
انظر معامل Max Pack
expiresIn لمعرفة الخيارات الإضافية.الـ
token المُعاد هو سلسلة معتّمة تبدأ بـ ayr_ls_؛ فهو ليس JWT قابلًا لفك التشفير ولا
يحمل أي حِمل قابل للقراءة. أرسل url إلى مستخدمك كما هي، وتعامل مع token كبيانات اعتماد
تحفظها لا تفحصها. الروابط التي أنشأتها سابقًا لا تزال تعمل.ينفّذ POST /profiles/link-sessions العملية نفسها بدون المعاملات القديمة، ويتيح كذلك التحقق
من رابط أو إبطاله. راجع إنشاء Link Session.معاملات الترويسة
string
مفتاح X API الخاص بك (Consumer Key) من X Developer Portal. بديل لمعامل الجسم
twitterApiKey. عند تزويده، سيستخدم رابط الربط المُولَّد تطبيق X Developer الخاص بك في ربط OAuth.string
X API Secret الخاص بك (Consumer Secret) من X Developer Portal. بديل لمعامل الجسم
twitterApiSecret. مطلوب عند تزويد X-Twitter-OAuth1-Api-Key.موصى به: مرّر بيانات اعتماد X عبر الترويسات (
X-Twitter-OAuth1-Api-Key وX-Twitter-OAuth1-Api-Secret) للاتساق مع بقية نقاط نهاية Ayrshare API. لا يزال معامَلا الجسم twitterApiKey وtwitterApiSecret مدعومَين للتوافق مع الإصدارات السابقة.معاملات الجسم
string
نطاق التطبيق. يُرجى استخدام النطاق نفسه الذي زُوّدت به أثناء الإعداد.اختياري. إذا أُغفل، يُستخدم نطاق حسابك نفسه. وإذا أرسلته، فيجب أن يكون نطاقًا مسجّلًا على حسابك.
string
مهمل
لم يُعد مستخدمًا. يُقبل هذا الحقل ويُتجاهل، لذا تستمر عمليات التكامل الحالية في العمل دون أي تغيير.لم تُعد روابط الربط موقّعة، لذا لا يوجد مفتاح لإرساله. يمكنك إزالة هذا الحقل والتوقف عن تخزين المفتاح الخاص لهذا الغرض.
string
مطلوب
Profile Key الخاص بالمستخدم. لا يمكن استخدام مفتاح API في هذا الحقل.
boolean
افتراضي:false
تسجيل الخروج التلقائي من الجلسة الحالية. لا يُنصح باستخدامه في بيئة الإنتاج لأنه يؤثر على الأداء.انظر تسجيل الخروج التلقائي من جلسة ملف تعريف لمزيد من المعلومات.
string
حدّد رابطًا لإعادة التوجيه إليه عند النقر على زر “Done” أو صورة الشعار. سيُختصر الرابط تلقائيًا في رابط الربط المُعاد. أعد توجيه نافذة الأصل الفاتحة بإضافة معامل الاستعلام
origin=true إلى رابط إعادة التوجيه.array
حدّد شبكات التواصل الاجتماعي المراد عرضها في صفحة الربط. سيتجاوز هذا شبكات التواصل الاجتماعي المُهيَّأة في صفحة Social Networks.
Only display Facebook, X/Twitter, LinkedIn, and TikTok
{
"allowedSocial": ["facebook", "twitter", "linkedin", "tiktok"]
}
string
تجاوز طريقة ربط إنستجرام المستخدمة عند نقر المستخدم على زر إنستجرام في صفحة الربط لهذا الرابط. القيم الصالحة:إذا حُذف، تستخدم صفحة الربط إعداد Instagram Login على مستوى حسابك.انظر Instagram Link Method لمزيد من المعلومات.
instagram: تسجيل دخول إنستجرام المباشر، دون الحاجة إلى صفحة فيسبوك.facebook: ربط إنستجرام عبر صفحة فيسبوك متصلة.
Force direct Instagram Login for this linking session
{
"instagramLinkMethod": "instagram"
}
boolean
مهمل
لم يُعد مستخدمًا. يُقبل هذا الحقل ويُتجاهل.لا يوجد توكن موقّع للتحقق منه: يتم التحقق من
token المُعاد عبر صفحة الربط عندما يفتح المستخدم الرابط.boolean
مهمل
لم يُعد مستخدمًا. يُقبل هذا الحقل ويُتجاهل، لأن
privateKey لم يُعد يُقرأ.number
افتراضي:5
حدّد مدة صلاحية الرمز بالدقائق. النطاق: من 1 دقيقة إلى 2880 دقيقة.انظر JWT Expires In لمزيد من المعلومات.
object
افتراضي:5
أرسل بريد Connect Accounts يتضمن رابطًا يتيح للمستخدمين الوصول مباشرةً إلى صفحة الربط الاجتماعي الخاصة بهم.انظر بريد Connect Accounts لمزيد من المعلومات.
عند تضمين بيانات اعتماد X API الخاصة بك، سيبدأ رابط الربط المُولَّد ربط OAuth باستخدام تطبيق X Developer الخاص بك. سيرى المستخدمون النهائيون اسم تطبيقك على شاشة موافقة X.
مطلوب: قبل استخدام هذه الميزة، يجب إضافة روابط callback التالية إلى إعدادات تطبيق X Developer الخاص بك (ضمن Authentication settings > Callback URI / Redirect URL):
https://profile.ayrshare.com/social-accountshttps://app.ayrshare.com/social-accounts
403 Callback URL not approved.curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-H "X-Twitter-OAuth1-Api-Key: YOUR_CONSUMER_KEY" \
-H "X-Twitter-OAuth1-Api-Secret: YOUR_CONSUMER_SECRET" \
-d '{"profileKey": "PROFILE_KEY"}' \
-X POST https://api.ayrshare.com/api/profiles/generateJWT
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
fetch("https://api.ayrshare.com/api/profiles/generateJWT", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`,
"X-Twitter-OAuth1-Api-Key": "YOUR_CONSUMER_KEY",
"X-Twitter-OAuth1-Api-Secret": "YOUR_CONSUMER_SECRET"
},
body: JSON.stringify({
profileKey: PROFILE_KEY, // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'profileKey': 'PROFILE_KEY'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY',
'X-Twitter-OAuth1-Api-Key': 'YOUR_CONSUMER_KEY',
'X-Twitter-OAuth1-Api-Secret': 'YOUR_CONSUMER_SECRET'}
r = requests.post('https://api.ayrshare.com/api/profiles/generateJWT',
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/post',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'profileKey' => 'PROFILE_KEY', // required
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace GenerateJWTRequest_csharp
{
class GenerateJWT
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles/generateJWT";
try
{
var sendData = new
{
profileKey = "PROFILE_KEY"
};
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
string jsonData = JsonConvert.SerializeObject(sendData);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
catch (Exception e)
{
Console.WriteLine($"Unexpected error: {e.Message}");
}
}
}
}
{
"status": "success",
"title": "User Profile Title",
"token": "ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu",
"url": "https://profile.ayrshare.com?session=ayr_ls_kJ8mQ2vX9pLnR4tYwZ6aBcD1eFgH3iJkLmN0oPqRsTu&domain=PROVIDED_DOMAIN",
"emailSent": true,
"expiresIn": "5m"
}
{
"action": "JWT",
"status": "error",
"code": 189,
"message": "Error generating JWT. Check the sent parameters.",
"details": "Missing or incorrect domain."
}
{
"action": "JWT",
"status": "error",
"code": 188,
"message": "Both twitterApiKey and twitterApiSecret are required. You provided only one."
}
{
"action": "JWT",
"status": "error",
"code": 434,
"message": "X/Twitter API credentials were provided in both the request headers and the request body. Please use the headers only. See https://www.ayrshare.com/docs/apis/profiles/generate-jwt"
}