ساخت فونت / آرت ASCII
با استفاده از این وبسرویس میتوانید متون خود را به آرت ASCII تبدیل کنید.
مشخصات
| مشخصه | مقدار |
|---|---|
| دستهبندی | ابزار |
| وضعیت | فعال |
| نسخه API | apis-1 |
| فرمت پاسخ | JSON |
| آدرس پایه | https://open.nestapi.ir |
| مسیر | /apis-1/ascii-art |
| لینک کامل | https://open.nestapi.ir/apis-1/ascii-art |
متدهای HTTP
| متد | مسیر | نوع ورودی |
|---|---|---|
GET | /apis-1/ascii-art | Query String |
پارامترها
پارامترهای Query String
| نام | نوع | الزامی | پیشفرض | توضیحات |
|---|---|---|---|---|
text | string | بله | — | متن انگلیسی یا عددی برای تبدیل به هنر اسکی |
font | string | خیر | Standard | نام فونت، مانند Standard، Slant، Doom، Ghost، 3-D یا Banner |
action | string | خیر | — | عملیات ویژه: fonts (فهرست فونتها)، random (فونت تصادفی) یا all (رندر متن با همهٔ فونتهای محبوب) |
q | string | خیر | — | فیلتر نام فونتها هنگام استفاده از action=fonts |
width | integer | خیر | — | حداکثر عرض خطوط (20 تا 300 کاراکتر) |
horizontalLayout | string | خیر | — | چیدمان و فاصلهٔ افقی کاراکترها: default، full، fitted، controlled smushing یا universal smushing |
verticalLayout | string | خیر | — | چیدمان عمودی خطوط متن |
type | string | خیر | json | نوع خروجی: json یا text (متن خالص برای استفاده در ترمینال) |
نمونه درخواست
لینک مستقیم
GET https://open.nestapi.ir/apis-1/ascii-art?text=Nest%20API
نمونه کد
- cURL
- PHP
- Python
- JavaScript
curl -X GET "https://open.nestapi.ir/apis-1/ascii-art?text=Nest%20API"
<?php
// composer require nestapi/nestapi
require 'vendor/autoload.php';
use NestApi\NestApi;
use NestApi\Exception\ApiException;
use NestApi\Exception\TransportException;
$api = new NestApi();
try {
$response = $api->asciiArt(text: 'Nest API');
print_r($response->data);
} catch (ApiException $e) {
// Error reported by the API (validation, not found, rate limit, ...)
echo $e->getMessage();
} catch (TransportException $e) {
// Network error or unusable response; not a subclass of ApiException
echo 'Network error: ' . $e->getMessage();
}
# pip install nestapi-py
from nestapi import ApiError, NestApi, TransportError
with NestApi() as api:
try:
response = api.ascii_art(text="Nest API")
print(response.data)
except ApiError as e:
# Error reported by the API (validation, not found, rate limit, ...)
print(e.error_code, e)
except TransportError as e:
# Network error or unusable response; not a subclass of ApiError
print("Network error:", e)
// npm install @devh3n/nestapi
import { ApiError, NestApi, TransportError } from "@devh3n/nestapi";
const api = new NestApi();
try {
const response = await api.asciiArt({ text: "Nest API" });
console.log(response.data);
} catch (error) {
if (error instanceof ApiError) {
// Error reported by the API (validation, not found, rate limit, ...)
console.error(error.errorCode, error.message);
} else if (error instanceof TransportError) {
// Network error or unusable response; not a subclass of ApiError
console.error("Network error:", error.message);
}
}
کدهای خطا
| کد | وضعیت | علت |
|---|---|---|
NOT_FOUND | 404 | مسیر وجود ندارد، یا متد روی آن ثبت نشده |
PARAM_NOT_FOUND | 400 | پارامتر لازم ارسال نشده |
VALIDATION_ERROR | 422 | پارامتر آمده ولی نوع، قالب یا بازهاش نادرست است |
FONT_NOT_FOUND | 404 | فونت موردنظر یافت نشد |
RENDER_ERROR | 500 | خطا در تولید متن و آرت ASCII |