curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://img.ayrshare.com/012/gb.jpg"}' \
-X POST https://api.ayrshare.com/api/generate/altText
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/generate/altText", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://img.ayrshare.com/012/gb.jpg", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://img.ayrshare.com/012/gb.jpg'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/generate/altText',
json=payload,
headers=headers)
print(r.json())
$curl = curl_init();
$data = array (
"url" => "https://img.ayrshare.com/012/gb.jpg"
);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ayrshare.com/api/generate/altText',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY',
'Accept-Encoding: gzip'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
class Program
{
// Replace 'YOUR_API_KEY' with your actual Ayrshare API key
private const string API_KEY = "YOUR_API_KEY";
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string imageUrl = "https://img.ayrshare.com/012/gb.jpg";
try
{
var result = await GenerateAltTextAsync(imageUrl);
Console.WriteLine("Generated Alt Text:");
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception e)
{
Console.WriteLine($"An error occurred: {e.Message}");
}
}
static async Task<JsonElement> GenerateAltTextAsync(string imageUrl)
{
var url = "https://api.ayrshare.com/api/generate/altText";
var requestData = new { url = imageUrl };
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}");
var json = JsonSerializer.Serialize(requestData);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"HTTP error! status: {response.StatusCode}");
}
var responseBody = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<JsonElement>(responseBody);
}
}
{
"status": "success",
"altText": "A ghostbusters vehicle driving through a field.",
"url": "https://img.ayrshare.com/012/gb.jpg"
}
{
"action": "upload",
"status": "error",
"code": 115,
"message": "An error occurred uploading your file, such as a timeout at the social network. Please try your post again with the /retryPost endpoint."
}
Generate
Alt Text उत्पन्न करें
अपनी छवियों के लिए AI-जनित alt text बनाएँ
POST
/
generate
/
altText
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://img.ayrshare.com/012/gb.jpg"}' \
-X POST https://api.ayrshare.com/api/generate/altText
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/generate/altText", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://img.ayrshare.com/012/gb.jpg", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://img.ayrshare.com/012/gb.jpg'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/generate/altText',
json=payload,
headers=headers)
print(r.json())
$curl = curl_init();
$data = array (
"url" => "https://img.ayrshare.com/012/gb.jpg"
);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ayrshare.com/api/generate/altText',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY',
'Accept-Encoding: gzip'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
class Program
{
// Replace 'YOUR_API_KEY' with your actual Ayrshare API key
private const string API_KEY = "YOUR_API_KEY";
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string imageUrl = "https://img.ayrshare.com/012/gb.jpg";
try
{
var result = await GenerateAltTextAsync(imageUrl);
Console.WriteLine("Generated Alt Text:");
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception e)
{
Console.WriteLine($"An error occurred: {e.Message}");
}
}
static async Task<JsonElement> GenerateAltTextAsync(string imageUrl)
{
var url = "https://api.ayrshare.com/api/generate/altText";
var requestData = new { url = imageUrl };
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}");
var json = JsonSerializer.Serialize(requestData);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"HTTP error! status: {response.StatusCode}");
}
var responseBody = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<JsonElement>(responseBody);
}
}
{
"status": "success",
"altText": "A ghostbusters vehicle driving through a field.",
"url": "https://img.ayrshare.com/012/gb.jpg"
}
{
"action": "upload",
"status": "error",
"code": 115,
"message": "An error occurred uploading your file, such as a timeout at the social network. Please try your post again with the /retryPost endpoint."
}
अपनी छवियों के लिए AI-जनित alt text बनाएँ। alt text लिखने के लिए भाषा चुनें और alt text में शामिल करने के लिए कीवर्ड चुनें।
हेडर पैरामीटर
बॉडी पैरामीटर
alt text बनाने के लिए छवि का Image URL।
https:// से शुरू होना चाहिए। JPEG, PNG, GIF, WEBP और BMP का समर्थन करता है।alt text उत्पन्न करते समय विचार किए जाने वाले कीवर्ड या वाक्यांशों की स्ट्रिंग सरणी। आमतौर पर alt text में सरणी से केवल एक या दो कीवर्ड ही उपयोग किए जाते हैं।
alt text आउटपुट करने के लिए भाषा। उपलब्ध language codes में से एक का उपयोग करें।
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://img.ayrshare.com/012/gb.jpg"}' \
-X POST https://api.ayrshare.com/api/generate/altText
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/generate/altText", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
url: "https://img.ayrshare.com/012/gb.jpg", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'url': 'https://img.ayrshare.com/012/gb.jpg'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/generate/altText',
json=payload,
headers=headers)
print(r.json())
$curl = curl_init();
$data = array (
"url" => "https://img.ayrshare.com/012/gb.jpg"
);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ayrshare.com/api/generate/altText',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY',
'Accept-Encoding: gzip'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
class Program
{
// Replace 'YOUR_API_KEY' with your actual Ayrshare API key
private const string API_KEY = "YOUR_API_KEY";
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string imageUrl = "https://img.ayrshare.com/012/gb.jpg";
try
{
var result = await GenerateAltTextAsync(imageUrl);
Console.WriteLine("Generated Alt Text:");
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception e)
{
Console.WriteLine($"An error occurred: {e.Message}");
}
}
static async Task<JsonElement> GenerateAltTextAsync(string imageUrl)
{
var url = "https://api.ayrshare.com/api/generate/altText";
var requestData = new { url = imageUrl };
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}");
var json = JsonSerializer.Serialize(requestData);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"HTTP error! status: {response.StatusCode}");
}
var responseBody = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<JsonElement>(responseBody);
}
}
{
"status": "success",
"altText": "A ghostbusters vehicle driving through a field.",
"url": "https://img.ayrshare.com/012/gb.jpg"
}
{
"action": "upload",
"status": "error",
"code": 115,
"message": "An error occurred uploading your file, such as a timeout at the social network. Please try your post again with the /retryPost endpoint."
}
⌘I
