curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"post": "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩"}' \
-X POST https://api.ayrshare.com/api/post/checkPostWeight
const API_KEY = "API_KEY";
const post = "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩";
fetch("https://api.ayrshare.com/api/post/checkPostWeight", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({ post }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': '🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post/checkPostWeight',
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/checkPostWeight',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'post' => ['🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩']
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CheckPostWeightRequest_csharp
{
class CheckPostWeight
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/checkPostWeight";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var content = new StringContent(
"{\"post\" : \"🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩\"}",
Encoding.UTF8,
"application/json"
);
try
{
var response = await httpClient.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"twitterWeightedLength": 2932,
"blueskyWeightedLength": 199,
"instagramWeightedLength": 3015,
"tikTokWeightedLength": 3017,
"linkedInWeightedLength": 3015,
"facebookWeightedLength": 3015,
"pinterestWeightedLength": 3015,
"youtubeWeightedLength": 3015,
"gmbWeightedLength": 3015,
"twitterValid": false,
"twitterLongValid": true,
"facebookValid": true,
"gmbValid": false,
"instagramValid": false,
"linkedInValid": false,
"pinterestValid": false,
"redditValid": true,
"tikTokValid": false,
"youtubeValid": true,
"maxCharLimits": {
"bluesky": 300,
"facebook": 63206,
"gmb": 1500,
"instagram": 2200,
"linkedin": 3000,
"pinterest": 500,
"reddit": 10000,
"tiktok": 2200,
"twitter": 280,
"twitterLong": 25000,
"youtube": 5000
}
}
Validate
Vérifier la longueur d'une publication
Calculez la longueur pondérée, ou nombre de caractères, d’une chaîne de publication
POST
/
validate
/
postLength
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"post": "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩"}' \
-X POST https://api.ayrshare.com/api/post/checkPostWeight
const API_KEY = "API_KEY";
const post = "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩";
fetch("https://api.ayrshare.com/api/post/checkPostWeight", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({ post }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': '🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post/checkPostWeight',
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/checkPostWeight',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'post' => ['🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩']
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CheckPostWeightRequest_csharp
{
class CheckPostWeight
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/checkPostWeight";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var content = new StringContent(
"{\"post\" : \"🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩\"}",
Encoding.UTF8,
"application/json"
);
try
{
var response = await httpClient.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"twitterWeightedLength": 2932,
"blueskyWeightedLength": 199,
"instagramWeightedLength": 3015,
"tikTokWeightedLength": 3017,
"linkedInWeightedLength": 3015,
"facebookWeightedLength": 3015,
"pinterestWeightedLength": 3015,
"youtubeWeightedLength": 3015,
"gmbWeightedLength": 3015,
"twitterValid": false,
"twitterLongValid": true,
"facebookValid": true,
"gmbValid": false,
"instagramValid": false,
"linkedInValid": false,
"pinterestValid": false,
"redditValid": true,
"tikTokValid": false,
"youtubeValid": true,
"maxCharLimits": {
"bluesky": 300,
"facebook": 63206,
"gmb": 1500,
"instagram": 2200,
"linkedin": 3000,
"pinterest": 500,
"reddit": 10000,
"tiktok": 2200,
"twitter": 280,
"twitterLong": 25000,
"youtube": 5000
}
}
Calculez la longueur pondérée, ou nombre de caractères, d’une chaîne de publication pour Bluesky, Facebook, Google Business Profile, Instagram, LinkedIn, Pinterest, Reddit, Threads, TikTok, X/Twitter et YouTube. Vérifie si la longueur de la publication est valide et retourne la longueur maximale autorisée pour chaque réseau social.
Les caractères spéciaux, tels que ü, ø ou 😊, ont une valeur de nombre de caractères plus élevée (unicode).
Cette vérification est effectuée automatiquement avec le point de terminaison /post.
La longueur pondérée est une estimation calculée par Ayrshare. Les réseaux sociaux peuvent avoir des comptages de caractères légèrement différents en fonction de leurs propres méthodes de calcul.
Paramètres d’en-tête
Paramètres du corps
Chaîne de publication pour laquelle calculer la longueur.
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"post": "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩"}' \
-X POST https://api.ayrshare.com/api/post/checkPostWeight
const API_KEY = "API_KEY";
const post = "🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩";
fetch("https://api.ayrshare.com/api/post/checkPostWeight", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({ post }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': '🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post/checkPostWeight',
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/checkPostWeight',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'post' => ['🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩']
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CheckPostWeightRequest_csharp
{
class CheckPostWeight
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/checkPostWeight";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var content = new StringContent(
"{\"post\" : \"🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩🍩\"}",
Encoding.UTF8,
"application/json"
);
try
{
var response = await httpClient.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"twitterWeightedLength": 2932,
"blueskyWeightedLength": 199,
"instagramWeightedLength": 3015,
"tikTokWeightedLength": 3017,
"linkedInWeightedLength": 3015,
"facebookWeightedLength": 3015,
"pinterestWeightedLength": 3015,
"youtubeWeightedLength": 3015,
"gmbWeightedLength": 3015,
"twitterValid": false,
"twitterLongValid": true,
"facebookValid": true,
"gmbValid": false,
"instagramValid": false,
"linkedInValid": false,
"pinterestValid": false,
"redditValid": true,
"tikTokValid": false,
"youtubeValid": true,
"maxCharLimits": {
"bluesky": 300,
"facebook": 63206,
"gmb": 1500,
"instagram": 2200,
"linkedin": 3000,
"pinterest": 500,
"reddit": 10000,
"tiktok": 2200,
"twitter": 280,
"twitterLong": 25000,
"youtube": 5000
}
}
⌘I
