เอกสาร API เปลี่ยนเฟอร์นิเจอร์#
URL พื้นฐาน:
https://api.ideal.house
เวอร์ชัน: v1
อัปเดต: 2026-05-21
📖 ภาพรวม#
API เปลี่ยนเฟอร์นิเจอร์ ปรับสไตล์หรือเปลี่ยนเฟอร์นิเจอร์ในภาพภายใน ส่งภาพต้นฉบับและคำแนะนำสไตล์ตัวเลือก จากนั้นตรวจสอบสถานะงานแบบอสังโครนัส
- สร้างงาน — ส่ง
imageUrlและคำแนะนำตัวเลือก จากนั้นรับtaskId - ตรวจสอบผลลัพธ์ — ใช้
taskIdเพื่อสอบถามสถานะงานและภาพผลลัพธ์
🔐 การยืนยันตัวตน#
คำขอ API ทั้งหมดต้องรวมคีย์ API ในหัวข้อความขอ
| หัวข้อ | ค่า |
|---|---|
APIKEY | your_api_key_here |
💰 การหักเครดิต#
[!WARNING] 🪙 เครดิต 1 จะถูกหักเมื่อสร้างงานสำเร็จ หากงาน ล้มเหลว ในที่สุด เครดิตที่ถูกหักจะ ถูกคืนอัตโนมัติ
เครดิตไม่เพียงพอจะคืนรหัสข้อผิดพลาด9051ดู อ้างอิงการหักเครดิต
| การดำเนินการ | เครดิตที่ถูกหัก |
|---|---|
| งานเปลี่ยนเฟอร์นิเจอร์ | เครดิต 1 |
🎨 ตัวเลือกสไตล์#
API นี้รองรับพารามิเตอร์สไตล์แบบไม่บังคับที่คืนโดยจุดปลายทาง API การตั้งค่าสไตล์
การใช้งาน:
GET /api/v1/style/change_furniture/getStyles
| กลุ่มสไตล์ | ฟิลด์คำขอ | คำอธิบาย |
|---|---|---|
roomType | indoorTypeId | ตัวเลือกประเภทห้อง |
style | indoorStyleId | ตัวเลือกสไตล์ภายใน |
elements | indoorElemId | ตัวเลือกองค์ประกอบห้อง รองรับหลายตัวเลือก ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2 |
แต่ละตัวเลือกประกอบด้วย:
| ฟิลด์ | คำอธิบาย |
|---|---|
name | ชื่อตัวเลือกหลายภาษา |
id | ค่าที่จะส่งในฟิลด์คำขอ |
url | ภาพตัวอย่างสำหรับตัวเลือก |
📌 เอนด์พอยต์ API#
1. สร้างงานเปลี่ยนเฟอร์นิเจอร์#
เอนด์พอยต์
POST /api/v1/changeFurniture/generate
หัวข้อความขอ
| หัวข้อ | จำเป็น | คำอธิบาย |
|---|---|---|
APIKEY | ✅ ใช่ | คีย์การยืนยันตัวตน API ของคุณ |
Content-Type | ✅ ใช่ | application/json |
เนื้อหาข้อความขอ
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
imageUrl | string | ✅ ใช่ | URL ของภาพภายในต้นฉบับ |
prompt | string | ❌ ไม่บังคับ | คำแนะนำข้อความสำหรับผลลัพธ์ที่ต้องการ |
indoorTypeId | string | ❌ ไม่บังคับ | ID ประเภทห้องจากตัวเลือกสไตล์ roomType |
indoorStyleId | string | ❌ ไม่บังคับ | ID สไตล์ภายในจากตัวเลือกสไตล์ style |
indoorElemId | string | ❌ ไม่บังคับ | ID องค์ประกอบห้องจากตัวเลือกสไตล์ elements รองรับหลาย ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2 |
เฉพาะ
imageUrlเท่านั้นที่จำเป็น ฟิลด์อื่นทั้งหมดเป็นตัวเลือก
🖼️ ข้อกำหนดของภาพ: ใช้ JPG/JPEG, PNG หรือ WebP แต่ละภาพต้องไม่เกิน 20 MB โดยมีขนาดตั้งแต่ 128 × 128 px ถึง 6,000 × 6,000 px (รวมขอบเขต) ภาพที่เกินขนาดพิกเซลสูงสุดจะถูกย่อสัดส่วนอัตโนมัติให้พอดีกับ 6,000 × 6,000 px ก่อนการประมวลผล URL ของภาพต้องเข้าถึงได้โดยตรงโดยเซิร์ฟเวอร์ API
📥 ตัวอย่างคำขอ#
cURL
curl -X POST "https://api.ideal.house/api/v1/changeFurniture/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/living-room.jpg",
"prompt": "replace the sofa with a modern warm neutral sofa",
"indoorTypeId": "Interior Design_Interior Scene_Living Room",
"indoorStyleId": "Interior_Interior Style_Popular_Modern Country",
"indoorElemId": "Interior Design_Scene Elements_Living Room_Shelving,Interior Design_Scene Elements_Living Room_Coffee Table"
}'
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class ChangeFurnitureApiExample {
private static final String BASE_URL = "https://api.ideal.house";
private static final String API_KEY = "your_api_key_here";
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
String requestBody = """
{
"imageUrl": "https://example.com/living-room.jpg",
"prompt": "replace the sofa with a modern warm neutral sofa",
"indoorTypeId": "Interior Design_Interior Scene_Living Room",
"indoorStyleId": "Interior_Interior Style_Popular_Modern Country",
"indoorElemId": "Interior Design_Scene Elements_Living Room_Shelving,Interior Design_Scene Elements_Living Room_Coffee Table"
}
""";
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/changeFurniture/generate")
.addHeader("APIKEY", API_KEY)
.addHeader("Content-Type", "application/json")
.post(RequestBody.create(requestBody, MediaType.parse("application/json")))
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Response: " + response.body().string());
}
}
}
Python (requests)
import requests
BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"
headers = {
"APIKEY": API_KEY,
"Content-Type": "application/json"
}
payload = {
"imageUrl": "https://example.com/living-room.jpg",
"prompt": "replace the sofa with a modern warm neutral sofa",
"indoorTypeId": "Interior Design_Interior Scene_Living Room",
"indoorStyleId": "Interior_Interior Style_Popular_Modern Country",
"indoorElemId": "Interior Design_Scene Elements_Living Room_Shelving,Interior Design_Scene Elements_Living Room_Coffee Table"
}
response = requests.post(
f"{BASE_URL}/api/v1/changeFurniture/generate",
headers=headers,
json=payload
)
data = response.json()
task_id = data.get("data")
print(f"Task ID: {task_id}")
Node.js (axios)
const axios = require('axios');
const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';
async function createChangeFurnitureTask() {
try {
const response = await axios.post(
`${BASE_URL}/api/v1/changeFurniture/generate`,
{
imageUrl: 'https://example.com/living-room.jpg',
prompt: 'replace the sofa with a modern warm neutral sofa',
indoorTypeId: 'Interior Design_Interior Scene_Living Room',
indoorStyleId: 'Interior_Interior Style_Popular_Modern Country',
indoorElemId: 'Interior Design_Scene Elements_Living Room_Shelving,Interior Design_Scene Elements_Living Room_Coffee Table'
},
{
headers: {
APIKEY: API_KEY,
'Content-Type': 'application/json'
}
}
);
const taskId = response.data.data;
console.log('Task ID:', taskId);
return taskId;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
createChangeFurnitureTask();
📤 คำตอบ#
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
| ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|
code | integer | 0 บ่งชี้ว่าสำเร็จ |
message | string | ข้อความตอบกลับ |
data | long | ID งานสำหรับการตรวจสอบสถานะผลลัพธ์ |
2. รับผลลัพธ์งาน#
เอนด์พอยต์
GET /api/v1/changeFurniture/result
หัวข้อความขอ
| หัวข้อ | จำเป็น | คำอธิบาย |
|---|---|---|
APIKEY | ✅ ใช่ | คีย์การยืนยันตัวตน API ของคุณ |
พารามิเตอร์ควอรี
| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
taskId | long | ✅ ใช่ | ID งานที่ส่งกลับจากเอนด์พอยต์สร้างงาน |
📥 ตัวอย่างคำขอ#
cURL
curl -X GET "https://api.ideal.house/api/v1/changeFurniture/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class ChangeFurnitureResultExample {
private static final String BASE_URL = "https://api.ideal.house";
private static final String API_KEY = "your_api_key_here";
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
long taskId = 1234567890123456789L;
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/changeFurniture/result?taskId=" + taskId)
.addHeader("APIKEY", API_KEY)
.get()
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Response: " + response.body().string());
}
}
}
Python (requests)
import requests
import time
BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"
headers = {"APIKEY": API_KEY}
task_id = 1234567890123456789
while True:
response = requests.get(
f"{BASE_URL}/api/v1/changeFurniture/result",
headers=headers,
params={"taskId": task_id}
)
data = response.json()
result = data.get("data", {})
status = result.get("status")
print(f"Status: {status}, Progress: {result.get('percentage')}%, Queue: {result.get('waitNumber')}")
if status in ("Success", "Failed"):
break
time.sleep(3)
if status == "Success":
print("Result URL:", result["output"]["resultUrl"])
else:
print("Task ended with status:", status)
Node.js (axios)
const axios = require('axios');
const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';
async function pollChangeFurnitureResult(taskId) {
const headers = { APIKEY: API_KEY };
while (true) {
const response = await axios.get(
`${BASE_URL}/api/v1/changeFurniture/result`,
{
headers,
params: { taskId }
}
);
const result = response.data.data;
const { status, percentage, waitNumber } = result;
console.log(`Status: ${status} | Progress: ${percentage}% | Queue: ${waitNumber}`);
if (['Success', 'Failed'].includes(status)) {
if (status === 'Success') {
console.log('Result URL:', result.output.resultUrl);
console.log('Size:', result.output.width, 'x', result.output.height);
} else {
console.log('Task ended with status:', status);
}
break;
}
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
pollChangeFurnitureResult(1234567890123456789n);
📤 ตัวอย่างคำตอบ#
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Success",
"waitNumber": 0,
"percentage": 100,
"input": {
"imageUrl": "https://example.com/living-room.jpg",
"prompt": "replace the sofa with a modern warm neutral sofa",
"indoorTypeId": "Interior Design_Interior Scene_Living Room",
"indoorStyleId": "Interior_Interior Style_Popular_Modern Country",
"indoorElemId": "Interior Design_Scene Elements_Living Room_Shelving,Interior Design_Scene Elements_Living Room_Coffee Table"
},
"output": {
"resultUrl": "https://cdn.ideal.house/output/change_furniture_result.jpg",
"width": 1024,
"height": 1024
}
}
}
คำตอบ (งานกำลังประมวลผล / อยู่ในคิว)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 1,
"percentage": 45,
"input": {
"imageUrl": "https://example.com/living-room.jpg",
"prompt": "replace the sofa with a modern warm neutral sofa"
},
"output": null
}
}
คำตอบ (งานล้มเหลว)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Failed",
"waitNumber": 0,
"percentage": 0,
"input": {
"imageUrl": "https://example.com/living-room.jpg"
},
"output": null
}
}
📊 สถานะงาน#
| สถานะ | คำอธิบาย |
|---|---|
Unprocessed | งานถูกสร้างแล้วและกำลังรออยู่ในคิว |
Processing | งานกำลังดำเนินการอยู่ |
Success | งานเสร็จสมบูรณ์ |
Failed | งานล้มเหลวและไม่มีผลลัพธ์ที่ผลิตได้ |
ตรวจสอบสถานะเป็นระยะทุก 3-5 วินาที ดู API ข้อจำกัดงาน
❌ คำตอบข้อผิดพลาด#
| รหัส | ชื่อ | คำอธิบาย |
|---|---|---|
1011 | PARAM_ERROR | ข้อผิดพลาดพารามิเตอร์คำขอ |
5002 | API_KEY_INVALID | คีย์ API ไม่ถูกต้องหรือไม่พบ |
9010 | SCAN_TEXT_ERROR | พรอมต์ไม่ผ่านการตรวจสอบเนื้อหา |
9038 | PROHIBITED_CONTENT | ภาพที่สร้างมามีเนื้อหาต้องห้าม |
9051 | COINS_NOT_ENOUGH | เครดิตไม่เพียงพอ |
สำหรับคำนิยามข้อผิดพลาดทั่วไปทั้งหมด ดู อ้างอิงรหัสข้อผิดพลาด