# เอกสาร API ของ Taisly - **OpenAPI Version:** `3.1.0` - **API Version:** `1.0.0` # เอกสาร API ของ Taisly API ของ Taisly ช่วยให้คุณสามารถทำให้การโพสต์วิดีโอและการแชร์ซ้ำไปยังหลายแพลตฟอร์มโซเชียลมีเดียเป็นแบบอัตโนมัติโดยใช้การยืนยันตัวตนด้วย API key อย่างง่าย ## ฟีเจอร์ - อัปโหลดและโพสต์วิดีโอไปยังหลายแพลตฟอร์มพร้อมกัน - ตั้งค่าการแชร์ซ้ำอัตโนมัติจากแพลตฟอร์มหนึ่งไปยังแพลตฟอร์มอื่นๆ - กำหนดเวลาโพสต์สำหรับภายหลัง - จัดการบัญชีโซเชียลมีเดียที่เชื่อมต่อ - ติดตามประวัติและสถานะการโพสต์ ## ข้อกำหนด - **แพลน**: STARTER, INFLUENCER หรือ PRO (API key ไม่พร้อมใช้งานในแพลน FREE) - **API key**: สร้างจากแดชบอร์ดของคุณที่ - **HTTPS**: คำขอ API ทั้งหมดต้องใช้ HTTPS ## ขีดจำกัดอัตราคำขอ | แพลน | คำขอต่อชั่วโมง | | ---------- | -------------- | | STARTER | 50 | | INFLUENCER | 200 | | PRO | 1000 | เมื่อคุณเกินขีดจำกัด คุณจะได้รับข้อผิดพลาด 429 พร้อมฟิลด์ `retryAfter` ที่ระบุว่าต้องรอกี่วินาที ## แนวปฏิบัติด้านความปลอดภัยที่ดีที่สุด 1. ห้าม commit API key ไปยัง version control 2. จัดเก็บ key ในตัวแปรสภาพแวดล้อม 3. สร้างใหม่ทันทีหากถูกเปิดเผย 4. ใช้ HTTPS เท่านั้น ## ข้อกำหนดวิดีโอ - **รูปแบบ**: MP4, MOV หรือรูปแบบวิดีโอทั่วไปอื่นๆ - **ขนาด**: สูงสุด 500MB - **ระยะเวลา**: 3-90 วินาที - **แนวนอน**: แนวตั้ง (9:16) ## ตัวอย่างเริ่มต้นอย่างรวดเร็ว ```bash # 1. รับแพลตฟอร์มที่เชื่อมต่อ curl -X GET https://app.taisly.com/api/private/platform/platforms \ -H "Authorization: Bearer taisly_your_api_key_here" # 2. อัปโหลดวิดีโอ curl -X POST https://app.taisly.com/api/private/post \ -H "Authorization: Bearer taisly_your_api_key_here" \ -F "video=@/path/to/video.mp4" \ -F "platforms=[\"platform_id_1\"]" \ -F "description=ดูวิดีโอใหม่ของฉัน!" # 3. ตรวจสอบประวัติการโพสต์ curl -X GET https://app.taisly.com/api/private/post/history \ -H "Authorization: Bearer taisly_your_api_key_here" ``` ## ตัวอย่าง Python ```python import requests API_KEY = 'taisly_your_api_key_here' BASE_URL = 'https://app.taisly.com/api/private' headers = { 'Authorization': f'Bearer {API_KEY}' } # รับแพลตฟอร์ม response = requests.get(f'{BASE_URL}/platform/platforms', headers=headers) platforms = response.json()['data'] print(f"แพลตฟอร์มที่เชื่อมต่อ: {len(platforms)}") # อัปโหลดวิดีโอ files = {'video': open('video.mp4', 'rb')} data = { 'platforms': str([platforms[0]['_id']]), 'description': 'คำอธิบายวิดีโอของฉัน' } response = requests.post(f'{BASE_URL}/post', headers=headers, files=files, data=data) print(response.json()) ``` ## Servers - **URL:** `https://app.taisly.com/api/private` - **Description:** เซิร์ฟเวอร์ production ## Operations ### รับข้อมูล API key - **Method:** `GET` - **Path:** `/user/api-key` - **Tags:** API Key Management ดึงข้อมูลเกี่ยวกับ API key ปัจจุบันของคุณ #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 403 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### สร้าง API key - **Method:** `POST` - **Path:** `/user/api-key/generate` - **Tags:** API Key Management สร้าง API key ใหม่หรือสร้างใหม่หากมีอยู่แล้ว **สำคัญ**: - API key แบบเต็มจะแสดงเพียงครั้งเดียวเท่านั้น จัดเก็บอย่างปลอดภัย - หากคุณสร้างใหม่ key เก่าจะถูกเพิกถอนทันที #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### เพิกถอน API key - **Method:** `POST` - **Path:** `/user/api-key/revoke` - **Tags:** API Key Management เพิกถอน API key ปัจจุบันของคุณทันที คำขอทั้งหมดที่ใช้ key นี้จะล้มเหลว #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 403 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### รับแพลตฟอร์มที่เชื่อมต่อ - **Method:** `GET` - **Path:** `/platform/platforms` - **Tags:** Platforms ดึงบัญชีโซเชียลมีเดียทั้งหมดที่เชื่อมต่อกับบัญชีของคุณ #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 403 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### สร้างโพสต์ - **Method:** `POST` - **Path:** `/post` - **Tags:** Posts อัปโหลดวิดีโอไปยังแพลตฟอร์มที่เชื่อมต่อหนึ่งแพลตฟอร์มหรือมากกว่า **ข้อกำหนดวิดีโอ:** - รูปแบบ: MP4, MOV หรือรูปแบบวิดีโอทั่วไปอื่นๆ - ขนาด: สูงสุด 500MB - ระยะเวลา: 3-90 วินาที - แนวนอน: แนวตั้ง (9:16) **การกำหนดเวลา:** - ส่ง `scheduled` เป็น Unix timestamp เป็นมิลลิวินาทีสำหรับการโพสต์ตามกำหนด (ละเว้นพารามิเตอร์นี้หากคุณไม่ต้องการกำหนดเวลา) #### Request Body ##### Content-Type: multipart/form-data - **`platforms` (required)** `array` — รายการ ID **Items:** `string` - **`video` (required)** `string`, format: `binary` — - **`description`** `string` - **`previewTime`** `number` — timestamp เป็นวินาทีสำหรับตัวอย่างวิดีโอ (ค่าเริ่มต้น: 0) - **`scheduled`** `string` **Example:** ```json { "video": {}, "platforms": [ "" ], "description": "", "previewTime": 1, "scheduled": "" } ``` #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 403 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### รับประวัติการโพสต์ - **Method:** `GET` - **Path:** `/post/history` - **Tags:** Posts ดึงประวัติการโพสต์ของคุณพร้อมข้อมูลสถานะสำหรับแต่ละแพลตฟอร์ม **การแบ่งหน้า:** - ใช้พารามิเตอร์ `page` สำหรับการแบ่งหน้า (10 รายการต่อหน้า) - หรือใช้ `startTime` และ `endTime` สำหรับการกรองช่วงวันที่ (ส่งกลับโพสต์ทั้งหมดที่ตรงกัน) **ค่าสถานะ:** - PENDING: โพสต์อยู่ในคิว - SUCCESS: โพสต์สำเร็จ - FAILED: โพสต์ล้มเหลว (ตรวจสอบฟิลด์ message สำหรับรหัสข้อผิดพลาด) #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### ยกเลิกโพสต์ที่กำหนดเวลา - **Method:** `GET` - **Path:** `/post/cancelSchedule` - **Tags:** Posts ยกเลิกโพสต์ที่กำหนดเวลาไว้สำหรับภายหลัง โพสต์จะถูกลบถาวร #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### รับการกำหนดค่าการแชร์ซ้ำ - **Method:** `GET` - **Path:** `/reposts` - **Tags:** Reposts ดึงกฎการแชร์ซ้ำอัตโนมัติทั้งหมดที่กำหนดค่าไว้ เมื่อคุณโพสต์ไปยังแพลตฟอร์ม 'from' เนื้อหาจะถูกแชร์ซ้ำโดยอัตโนมัติไปยังแพลตฟอร์ม 'to' ทั้งหมด #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### เพิ่มการกำหนดค่าการแชร์ซ้ำ - **Method:** `POST` - **Path:** `/repost/add` - **Tags:** Reposts กำหนดค่าการแชร์ซ้ำอัตโนมัติจากแพลตฟอร์มหนึ่งไปยังแพลตฟอร์มอื่นๆ **วิธีการทำงาน:** - เมื่อคุณโพสต์เนื้อหาไปยังแพลตฟอร์ม 'from' มันจะถูกแชร์ซ้ำโดยอัตโนมัติไปยังแพลตฟอร์ม 'to' ทั้งหมด **หมายเหตุ**: การพึ่งพาแบบวงกลมจะถูกป้องกัน คุณไม่สามารถสร้าง A→B ได้หาก B→A มีอยู่แล้ว #### Request Body ##### Content-Type: application/json - **`from` (required)** `string` — ID ของแพลตฟอร์ม - **`to` (required)** `array` — รายการ ID ของแพลตฟอร์ม **Items:** `string` **Example:** ```json { "from": "", "to": [ "" ] } ``` #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 400 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### ลบการกำหนดค่าการแชร์ซ้ำ - **Method:** `POST` - **Path:** `/repost/delete` - **Tags:** Reposts ลบกฎการแชร์ซ้ำอัตโนมัติ โพสต์ในอนาคตไปยังแพลตฟอร์มต้นทางจะไม่ถูกแชร์ซ้ำโดยอัตโนมัติอีกต่อไป #### Request Body ##### Content-Type: application/json - **`id` (required)** `string` **Example:** ```json { "id": "" } ``` #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json ### หยุด/ดำเนินการต่อการกำหนดค่าการแชร์ซ้ำ - **Method:** `POST` - **Path:** `/repost/pause` - **Tags:** Reposts หยุดหรือดำเนินการต่อการแชร์ซ้ำอัตโนมัติชั่วคราว มีประโยชน์เมื่อคุณต้องการหยุดการแชร์ซ้ำชั่วคราวโดยไม่ลบการกำหนดค่า #### Request Body ##### Content-Type: application/json - **`id` (required)** `string` - **`isPaused` (required)** `boolean` **Example:** ```json { "id": "", "isPaused": true } ``` #### Responses ##### Status: 200 ###### Content-Type: application/json ##### Status: 401 ###### Content-Type: application/json ##### Status: 500 ###### Content-Type: application/json