پرش به مطلب اصلی

فهرست

این سند نقاط پایانی API موجود برای برنامه‌های کلاینت جهت تعامل با پست‌ها در ماژول CMS را توضیح می‌دهد.

دریافت لیست پست‌ها

بازیابی لیست پست‌ها بر اساس فیلترهای مشخص شده.

نقطه پایانی

GET /api/client/v3/cms/post

هدرهای درخواست

Api-Key: {{api-key}}

پارامترهای پرس‌وجو

پارامترنوعالزامیتوضیحات
includesstringخیرموجودیت‌های مرتبط برای گنجاندن در پاسخ (مثلاً mainCategory)
field_setsobjectخیرشیء JSON که مشخص می‌کند کدام فیلدها برای هر نوع موجودیت گنجانده شوند
excludesstringخیرفیلدهایی که باید از پاسخ حذف شوند
searchstringخیرعبارات جستجو با قالب field:value
searchFieldsstringخیرفیلدهایی که در آنها جستجو شود
searchJoinstringخیرنحوه پیوند عبارات جستجوی چندگانه (and یا or)
per_pageintegerخیرتعداد آیتم‌ها در هر صفحه (پیش‌فرض: 15)
pageintegerخیرشماره صفحه برای صفحه‌بندی (پیش‌فرض: 1)

کدهای وضعیت پاسخ

کد وضعیتتوضیحات
200موفقیت
400درخواست نامعتبر - پارامترهای نامعتبر
401غیرمجاز - کلید API نامعتبر یا گم شده
404یافت نشد - هیچ پستی با معیارها مطابقت ندارد
500خطای سرور

ساختار پاسخ موفق

یک پاسخ موفق دارای ساختار زیر خواهد بود:

{
"status": true,
"result": [
// آرایه‌ای از اشیاء پست
],
"meta": {
"pagination": {
// اطلاعات صفحه‌بندی
}
}
}

مثال پاسخ

{
"status": true,
"result": [
{
"id": 1,
"slug": "post-slug",
"wp_slug": null,
"type": {
"name": "Post",
"value": "post",
"cases": {
"Post": "post",
"Page": "page",
"Video": "video",
"Podcast": "podcast",
"Gallery": "gallery",
"Terminology": "terminology",
"Encyclopedia": "encyclopedia",
"Story": "story",
"Landing": "landing"
},
"to_persian": "مقاله"
},
"creator_id": 1,
"author_id": 1,
"title": "Post Title",
"content": {
"short": "Post Short Content",
"full": "Post Full Content",
"lines": 1,
"words": 3,
"read_times": 10,
"toc_menus": []
},
"thumbnail": {
"id": "ad8e78f9-ea67-417e-a302-9f4f4fe85aaa",
"collection_name": "image",
"url": "https://example.com/1000038179-635gozhq.jpg",
"mime_type": "image/jpeg",
"type": "image",
"format": "jpeg",
"size": "138.66 KB",
"size_details": {
"bytes": 141989,
"human": {
"default": "138.66 KB"
}
},
"title": null,
"status": "active",
"name": "1000038179-635gozhq.jpg",
"meta_data": {
"original_width": 1000,
"original_height": 600,
"duration": 0
},
"dimension": {
"width": 1000,
"height": 600,
"ratioWidth": 5,
"ratioHeight": 3,
"human": {
"default": "1000x600",
"ratio": "5:3"
}
},
"medium_thumbnail": {
"url": "https://example.com/1000038179-635gozhq-medium_thumbnail.jpg",
"width": 666,
"height": 400
},
"small_thumbnail": {
"url": "https://example.com/1000038179-635gozhq-small_thumbnail.jpg",
"width": 166,
"height": 100
}
},
"vocabulary_fa": null,
"vocabulary_en": null,
"seo": {
"og": {
"image": {
"alt": null,
"type": null,
"width": null,
"height": null
},
"title": null,
"locale": null,
"description": null
},
"title": null,
"description": null,
"canonical_url": null,
"focus_keyword": null
},
"meta": {
"views": 88,
"is_featured": false
},
"properties": null,
"status": {
"name": "Published",
"value": "published",
"cases": {
"Draft": "draft",
"Pending": "pending",
"Verified": "verified",
"Published": "published",
"Archived": "archived",
"Trash": "trash"
},
"to_persian": "منتشر شده"
},
"note": null,
"deadline": null,
"cache": {
"uploaded_media_count": 0,
"uploaded_gallery_count": 0
},
"created_at": {
"main": "2025-03-19 15:17:57",
"default": "2025-03-19",
"short": "25-03-19",
"long": "امروز 19, Mar ماه سال 2025",
"en_long": "March 19, 2025 15:17",
"year": 2025,
"month": 3,
"month_name": "Mar",
"day": 19,
"timestamp": 1742384877,
"diff_in_min": 24957,
"diff_in_hour": 415,
"diff_in_day": 17,
"diff_for_human": "2 هفته قبل",
"timezone": "Asia/Tehran",
"jalali": {
"main": "1403/12/29 15:17:57",
"short": "1403/12/29",
"long": "امروز 29, اسفند ماه سال 1403",
"year": 1403,
"month": 12,
"month_name": "اسفند",
"day": 29,
"diff_in_min": 24957,
"diff_in_hour": 415,
"diff_in_day": 17,
"diff_for_human": "2 هفته قبل",
"human": "29 اسفند 1403",
"hour": "15:17",
"timezone": "Asia/Tehran"
},
"human": {
"default": "29 اسفند 1403",
"short": "1403/12/29",
"long": "29 اسفند 1403 ساعت 15:17",
"dayOfWeek": "چهارشنبه",
"month": "اسفند",
"year": 1403,
"dayMonth": "29 اسفند",
"diff": "2 هفته قبل",
"gregorian": {
"default": "25-03-19",
"short": "25-03-19",
"long": "March 19, 2025 15:17",
"dayOfWeek": "Wednesday",
"month": "March",
"year": 2025,
"dayMonth": "March 19",
"diff": "2 weeks ago"
}
}
},
"published_at": {
"main": "2025-03-24 11:24:48",
"default": "2025-03-24",
"short": "25-03-24",
"long": "امروز 24, Mar ماه سال 2025",
"en_long": "March 24, 2025 11:24",
"year": 2025,
"month": 3,
"month_name": "Mar",
"day": 24,
"timestamp": 1742867088,
"diff_in_min": 17266,
"diff_in_hour": 287,
"diff_in_day": 11,
"diff_for_human": "1 هفته قبل",
"timezone": "Asia/Tehran",
"jalali": {
"main": "1404/01/05 11:24:48",
"short": "1404/01/05",
"long": "امروز 05, فروردین ماه سال 1404",
"year": 1404,
"month": 1,
"month_name": "فروردین",
"day": 5,
"diff_in_min": 17266,
"diff_in_hour": 287,
"diff_in_day": 11,
"diff_for_human": "1 هفته قبل",
"human": "5 فروردین 1404",
"hour": "11:24",
"timezone": "Asia/Tehran"
},
"human": {
"default": "5 فروردین 1404",
"short": "1404/01/05",
"long": "5 فروردین 1404 ساعت 11:24",
"dayOfWeek": "یکشنبه",
"month": "فروردین",
"year": 1404,
"dayMonth": "5 فروردین",
"diff": "1 هفته قبل",
"gregorian": {
"default": "25-03-24",
"short": "25-03-24",
"long": "March 24, 2025 11:24",
"dayOfWeek": "Sunday",
"month": "March",
"year": 2025,
"dayMonth": "March 24",
"diff": "1 week ago"
}
}
},
"author": {
"id": 1,
"slug": "admin",
"roles": [],
"badges": null,
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"mobile": null,
"status": {
"name": "Active",
"value": "active",
"cases": {
"Active": "active",
"Inactive": "inactive",
"Banned": "banned"
},
"to_persian": "فعال"
},
"avatar": {
"id": "",
"collection_name": "avatar",
"url": "https://example.com/avatar.png",
"mime_type": "image/png",
"type": "image",
"format": "png",
"size": "4.86 KB",
"size_details": {
"bytes": 4982,
"human": {
"default": "4.86 KB"
}
},
"title": null,
"status": "active",
"name": "avatar",
"meta_data": {
"original_width": 512,
"original_height": 512,
"duration": 0
},
"dimension": {
"width": 512,
"height": 512,
"ratioWidth": 1,
"ratioHeight": 1,
"human": {
"default": "512x512",
"ratio": "1:1"
}
},
"medium_thumbnail": {
"url": "https://example.com/avatar-medium_thumbnail.png",
"width": 400,
"height": 400
},
"small_thumbnail": {
"url": "https://example.com/avatar-small_thumbnail.png",
"width": 100,
"height": 100
}
}
},
"icon": "si-chart-bar",
"views": 88,
"mainCategory": {
"id": 14217,
"type": "category",
"slug": "communication",
"name_en": "communication",
"name_fa": "ارتباطات",
"parent_id": 14216,
"description": null,
"meta": {
"posts_count": 5,
"is_featured": false
},
"status": {
"name": "Active",
"value": "active",
"cases": {
"Active": "active",
"Inactive": "inactive"
},
"to_persian": "فعال"
},
"thumbnail": {
"id": "",
"url": "https://example.com/default-rectangle.png",
"name": "default-rectangle",
"size": "11.39 KB",
"meta_data": {
"original_width": 1000,
"original_height": 600,
"duration": 0
},
"dimension": {
"width": 1000,
"height": 600,
"ratioWidth": 5,
"ratioHeight": 3,
"human": {
"default": "1000x600",
"ratio": "5:3"
}
}
}
}
}
],
"meta": {
"pagination": {
"total": 1086,
"count": 1,
"per_page": 1,
"current_page": 1,
"total_pages": 1086,
"links": {
"next": "https://example.com/api/client/v3/cms/post?page=2"
}
}
}
}

مثال‌های پاسخ خطا

400 درخواست نامعتبر

{
"status": false,
"error": {
"code": "bad_request",
"message": "Invalid parameters",
"details": {
"per_page": ["The per_page must be an integer."]
}
}
}

401 غیرمجاز

{
"status": false,
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}

مثال‌های استفاده

درخواست پایه

GET /api/client/v3/cms/post
Api-Key: {{api-key}}

فیلتر کردن بر اساس وضعیت

GET /api/client/v3/cms/post?search=status:published&searchFields=status&searchJoin=and
Api-Key: {{api-key}}

مثال صفحه‌بندی

GET /api/client/v3/cms/post?per_page=10&page=2
Api-Key: {{api-key}}