Files
site_backend/Zoneco_ORG_API.postman_collection.json
Shayan Azadi 50c9cf613f Add admin login API and remove hardcoded secrets
- Add token-based admin login/logout/me endpoints
- Bootstrap admin from ADMIN_USERNAME/ADMIN_PASSWORD in Docker entrypoint
- Read ALLOWED_HOSTS and CORS from env only (no hardcoded server IPs)
- Keep docs/Postman/tests free of real credentials
- Cover login and auth flows with 31 local API tests

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 17:29:47 +03:30

716 lines
16 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"info": {
"_postman_id": "zoneco-org-api-collection",
"name": "Zoneco ORG API",
"description": "مجموعه کامل APIهای بک‌اند Zoneco ORG.\n\n1) متغیرهای collection را تنظیم کنید: base_url, admin_username, admin_password\n2) Admin Auth > POST Admin Login را بزنید\n3) توکن در admin_token ذخیره می‌شود\n4) درخواست‌های ادمین با Authorization: Token {{admin_token}} ارسال می‌شوند\n\nCredentials را در متغیرها بگذارید — در کد هاردکد نکنید.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Admin Auth",
"description": "ورود ادمین با username/password و دریافت توکن",
"item": [
{
"name": "POST Admin Login",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"if (pm.response.code === 200) {",
" var json = pm.response.json();",
" if (json.token) {",
" pm.collectionVariables.set('admin_token', json.token);",
" }",
"}"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{admin_username}}\",\n \"password\": \"{{admin_password}}\"\n}"
},
"url": "{{base_url}}/api/admin/login/",
"description": "Login with admin credentials. Saves token to admin_token automatically."
}
},
{
"name": "GET Admin Me",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": "{{base_url}}/api/admin/me/"
}
},
{
"name": "POST Admin Logout",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"url": "{{base_url}}/api/admin/logout/"
}
}
]
},
{
"name": "Contact Us",
"description": "APIهای فرم تماس با ما",
"item": [
{
"name": "GET All Contact Us",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/contact-us/"
}
},
{
"name": "GET Contact Us by ID",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/contact-us/1/"
}
},
{
"name": "POST Create Contact Us",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"احمد محمدی\",\n \"email_or_phone\": \"ahmad@example.com\",\n \"description\": \"سلام، می‌خواستم در مورد خدمات شما اطلاعات بیشتری دریافت کنم.\",\n \"category\": \"پشتیبانی\"\n}"
},
"url": "{{base_url}}/api/contact-us/"
}
},
{
"name": "GET Contact Us by Category",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/contact-us/by_category/?category=پشتیبانی",
"host": [
"{{base_url}}"
],
"path": [
"api",
"contact-us",
"by_category",
""
],
"query": [
{
"key": "category",
"value": "پشتیبانی",
"description": "همکاری | فروش | پشتیبانی | درخواست مشاور | سایر"
}
]
}
}
},
{
"name": "PATCH Update Contact Us (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"نام بروزرسانی شده\"\n}"
},
"url": "{{base_url}}/api/contact-us/1/"
}
},
{
"name": "DELETE Contact Us (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": "{{base_url}}/api/contact-us/1/"
}
}
]
},
{
"name": "Compositions",
"description": "APIهای ترکیبات — پشتیبانی از آپلود چند تصویر با تصویر اصلی",
"item": [
{
"name": "GET All Compositions",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/compositions/"
}
},
{
"name": "GET Composition by ID",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/compositions/{{composition_id}}/"
}
},
{
"name": "GET Compositions by Created At",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/compositions/by-created-at/?from=2026-01-01T00:00:00Z&to=2026-12-31T23:59:59Z",
"host": [
"{{base_url}}"
],
"path": [
"api",
"compositions",
"by-created-at",
""
],
"query": [
{
"key": "from",
"value": "2026-01-01T00:00:00Z",
"description": "Start datetime — ISO 8601 (UTC). At least one of from/to required."
},
{
"key": "to",
"value": "2026-12-31T23:59:59Z",
"description": "End datetime — ISO 8601 (UTC). At least one of from/to required."
}
]
}
}
},
{
"name": "POST Create Composition (JSON)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"ترکیب تست\",\n \"description\": \"این یک ترکیب تستی است\"\n}"
},
"url": "{{base_url}}/api/compositions/"
}
},
{
"name": "POST Create Composition with Images",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "name",
"value": "ترکیب با تصویر",
"type": "text"
},
{
"key": "description",
"value": "ترکیب با چند تصویر",
"type": "text"
},
{
"key": "uploaded_images",
"type": "file",
"src": []
},
{
"key": "uploaded_images",
"type": "file",
"src": []
},
{
"key": "main_image_index",
"value": "0",
"type": "text",
"description": "ایندکس تصویر اصلی (از 0)"
}
]
},
"url": "{{base_url}}/api/compositions/"
}
},
{
"name": "POST Add Images to Composition (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "uploaded_images",
"type": "file",
"src": []
},
{
"key": "main_image_index",
"value": "0",
"type": "text"
}
]
},
"url": "{{base_url}}/api/compositions/{{composition_id}}/add-images/"
}
},
{
"name": "POST Set Main Image (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"image_id\": {{image_id}}\n}"
},
"url": "{{base_url}}/api/compositions/{{composition_id}}/set-main-image/"
}
},
{
"name": "DELETE Composition Image (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": "{{base_url}}/api/compositions/{{composition_id}}/images/{{image_id}}/"
}
},
{
"name": "PATCH Update Composition (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"نام بروزرسانی شده\"\n}"
},
"url": "{{base_url}}/api/compositions/{{composition_id}}/"
}
},
{
"name": "DELETE Composition (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": "{{base_url}}/api/compositions/{{composition_id}}/"
}
}
]
},
{
"name": "Campaigns",
"description": "APIهای کمپین‌ها",
"item": [
{
"name": "GET All Campaigns",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/campaigns/"
}
},
{
"name": "GET Campaign by ID",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/campaigns/1/"
}
},
{
"name": "POST Create Campaign",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"کمپین تست\",\n \"description\": \"این یک کمپین تستی است\",\n \"start_time\": \"2026-06-01T00:00:00Z\",\n \"end_time\": \"2026-12-31T23:59:59Z\"\n}"
},
"url": "{{base_url}}/api/campaigns/"
}
},
{
"name": "POST Create Campaign with Image",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "name",
"value": "کمپین با تصویر",
"type": "text"
},
{
"key": "description",
"value": "توضیحات کمپین",
"type": "text"
},
{
"key": "start_time",
"value": "2026-06-01T00:00:00Z",
"type": "text"
},
{
"key": "end_time",
"value": "2026-12-31T23:59:59Z",
"type": "text"
},
{
"key": "image",
"type": "file",
"src": []
}
]
},
"url": "{{base_url}}/api/campaigns/"
}
},
{
"name": "GET Active Campaigns",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/campaigns/active/"
}
},
{
"name": "GET Upcoming Campaigns",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/campaigns/upcoming/"
}
},
{
"name": "GET Ended Campaigns",
"request": {
"method": "GET",
"header": [],
"url": "{{base_url}}/api/campaigns/ended/"
}
},
{
"name": "PATCH Update Campaign (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"نام بروزرسانی شده\"\n}"
},
"url": "{{base_url}}/api/campaigns/1/"
}
},
{
"name": "DELETE Campaign (Admin)",
"request": {
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "Authorization",
"type": "string"
},
{
"key": "value",
"value": "Token {{admin_token}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": "{{base_url}}/api/campaigns/1/"
}
}
]
}
],
"variable": [
{
"key": "base_url",
"value": "http://127.0.0.1:8000",
"type": "string"
},
{
"key": "composition_id",
"value": "1",
"type": "string"
},
{
"key": "image_id",
"value": "1",
"type": "string"
},
{
"key": "admin_username",
"value": "",
"type": "string"
},
{
"key": "admin_password",
"value": "",
"type": "string"
},
{
"key": "admin_token",
"value": "",
"type": "string"
}
]
}