Ideal House
ข้ามไปยังเนื้อหา

เอกสาร API ปรับปรุงการตกแต่งภายใน#

URL พื้นฐาน: https://api.ideal.house
เวอร์ชัน: v1
อัปเดต: 2026-05-21


📖 ภาพรวม#

API ปรับปรุงการตกแต่งภายใน ปรับปรุงภาพภายในและสามารถใช้งานตัวเลือกสไตล์ห้อง คำแนะนำข้อความ และคำแนะนำสีเป็นตัวเลือกได้

เวิร์กโฟลว์เป็นแบบอสังโครนัส:

  1. สร้างงาน — ส่ง imageUrl และพารามิเตอร์ตัวเลือก จากนั้นรับ taskId
  2. ตรวจสอบผลลัพธ์ — ใช้ taskId เพื่อดึงสถานะงานและภาพที่สร้าง

🔐 การยืนยันตัวตน#

หัวข้อค่า
APIKEYyour_api_key_here

💰 การหักเครดิต#

[!WARNING] 🪙 เครดิต 1 จะถูกหักเมื่อสร้างงานสำเร็จ หากงาน ล้มเหลว ในที่สุด เครดิตที่ถูกหักจะ ถูกคืนอัตโนมัติ
เครดิตไม่เพียงพอจะคืนรหัสข้อผิดพลาด 9051 ดู อ้างอิงการหักเครดิต

การดำเนินการเครดิตที่ถูกหัก
งานปรับปรุงการตกแต่งภายในเครดิต 1

🎨 ตัวเลือกสไตล์#

API นี้รองรับพารามิเตอร์สไตล์แบบไม่บังคับที่คืนโดยจุดปลายทาง API การตั้งค่าสไตล์

การใช้งาน:

ข้อความธรรมดา
GET /api/v1/style/interoir_remodel/getStyles
กลุ่มสไตล์ฟิลด์คำขอคำอธิบาย
roomTypeindoorTypeIdตัวเลือกประเภทห้อง
styleindoorStyleIdตัวเลือกสไตล์ภายใน
elementsindoorElemIdตัวเลือกองค์ประกอบห้อง รองรับหลายตัวเลือก ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2

แต่ละตัวเลือกประกอบด้วย name, id และ url ส่ง id ของตัวเลือกไปยังฟิลด์คำขอที่สอดคล้องกัน


🎨 คำแนะนำสี#

colorString และ colorImgUrl เป็นอินพุตคำแนะนำสีที่เป็นตัวเลือก:

กรณีพฤติกรรม
ระบุเฉพาะ colorStringใช้ colorString
ระบุเฉพาะ colorImgUrlใช้ภาพอ้างอิงสี
ระบุทั้งสองอย่างcolorString มีลำดับความสำคัญสูงกว่า
ไม่ระบุทั้งสองอย่างคำแนะนำสีจะตั้งค่านั้นเริ่มต้นเป็น auto

📌 เอนด์พอยต์ API#

1. สร้างงานปรับปรุงการตกแต่งภายใน#

เอนด์พอยต์

ข้อความธรรมดา
POST /api/v1/interiorRemodel/generate

หัวข้อความขอ

หัวข้อจำเป็นคำอธิบาย
APIKEY✅ ใช่คีย์การยืนยันตัวตน API ของคุณ
Content-Type✅ ใช่application/json

เนื้อหาข้อความขอ

ฟิลด์ประเภทจำเป็นคำอธิบาย
imageUrlstring✅ ใช่URL ของภาพภายในต้นฉบับ
promptstring❌ ไม่บังคับคำแนะนำข้อความสำหรับงานปรับปรุงที่ต้องการ
indoorTypeIdstring❌ ไม่บังคับID ประเภทห้องจากตัวเลือกสไตล์ roomType
indoorStyleIdstring❌ ไม่บังคับID สไตล์ภายในจากตัวเลือกสไตล์ style
indoorElemIdstring❌ ไม่บังคับID องค์ประกอบห้องจากตัวเลือกสไตล์ elements รองรับหลาย ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2
colorStringstring❌ ไม่บังคับสตริงพาเลตสี เช่น [[174,238,238],[36,36,36]]
colorImgUrlstring❌ ไม่บังคับURL ของภาพอ้างอิงสี

เฉพาะ imageUrl เท่านั้นที่จำเป็น ฟิลด์อื่นทั้งหมดเป็นตัวเลือก

🖼️ ข้อกำหนดของภาพ: ภาพต้นฉบับและภาพอ้างอิงทั้งหมดต้องเป็น JPG/JPEG, PNG หรือ WebP แต่ละภาพต้องไม่เกิน 20 MB โดยมีขนาดตั้งแต่ 128 × 128 px ถึง 6,000 × 6,000 px (รวมขอบเขต) ภาพที่เกินขนาดพิกเซลสูงสุดจะถูกย่อสัดส่วนอัตโนมัติให้พอดีกับ 6,000 × 6,000 px ก่อนการประมวลผล URLs ของภาพต้องเข้าถึงได้โดยตรงโดยเซิร์ฟเวอร์ API

📥 ตัวอย่างคำขอ#

cURL
bash
curl -X POST "https://api.ideal.house/api/v1/interiorRemodel/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/interior.jpg",
    "prompt": "modern warm remodel with clean built-in storage",
    "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",
    "colorString": "[[174,238,238],[36,36,36],[117,64,95]]"
  }'
Java (OkHttp)
java
import okhttp3.*;

import java.io.IOException;

public class InteriorRemodelApiExample {

    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/interior.jpg",
                    "prompt": "modern warm remodel with clean built-in storage",
                    "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",
                    "colorString": "[[174,238,238],[36,36,36],[117,64,95]]"
                }
                """;

        Request request = new Request.Builder()
                .url(BASE_URL + "/api/v1/interiorRemodel/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)
python
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/interior.jpg",
    "prompt": "modern warm remodel with clean built-in storage",
    "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",
    "colorString": "[[174,238,238],[36,36,36],[117,64,95]]"
}

response = requests.post(
    f"{BASE_URL}/api/v1/interiorRemodel/generate",
    headers=headers,
    json=payload
)

data = response.json()
task_id = data.get("data")
print(f"Task ID: {task_id}")
Node.js (axios)
javascript
const axios = require('axios');

const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';

async function createInteriorRemodelTask() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/interiorRemodel/generate`,
      {
        imageUrl: 'https://example.com/interior.jpg',
        prompt: 'modern warm remodel with clean built-in storage',
        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',
        colorString: '[[174,238,238],[36,36,36],[117,64,95]]'
      },
      {
        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);
  }
}

createInteriorRemodelTask();

📤 คำตอบ#

json
{
  "code": 0,
  "message": "success",
  "data": 1234567890123456789
}

2. รับผลลัพธ์งาน#

เอนด์พอยต์

ข้อความธรรมดา
GET /api/v1/interiorRemodel/result

หัวข้อความขอ

หัวข้อจำเป็นคำอธิบาย
APIKEY✅ ใช่คีย์การยืนยันตัวตน API ของคุณ

พารามิเตอร์ควอรี

พารามิเตอร์ประเภทจำเป็นคำอธิบาย
taskIdlong✅ ใช่ID งานที่ส่งกลับจากเอนด์พอยต์สร้างงาน

📥 ตัวอย่างคำขอ#

cURL
bash
curl -X GET "https://api.ideal.house/api/v1/interiorRemodel/result?taskId=1234567890123456789" \
  -H "APIKEY: your_api_key_here"
Java (OkHttp)
java
import okhttp3.*;

import java.io.IOException;

public class InteriorRemodelResultExample {

    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/interiorRemodel/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)
python
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/interiorRemodel/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)
javascript
const axios = require('axios');

const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';

async function pollInteriorRemodelResult(taskId) {
  const headers = { APIKEY: API_KEY };

  while (true) {
    const response = await axios.get(
      `${BASE_URL}/api/v1/interiorRemodel/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));
  }
}

pollInteriorRemodelResult(1234567890123456789n);

📤 ตัวอย่างคำตอบ#

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Success",
    "waitNumber": 0,
    "percentage": 100,
    "input": {
      "imageUrl": "https://example.com/interior.jpg",
      "prompt": "modern warm remodel with clean built-in storage",
      "indoorTypeId": "Interior Design_Interior Scene_Living Room",
      "indoorStyleId": "Interior_Interior Style_Popular_Modern Country",
      "colorString": "[[174,238,238],[36,36,36],[117,64,95]]"
    },
    "output": {
      "resultUrl": "https://cdn.ideal.house/output/interior_remodel_result.jpg",
      "width": 1024,
      "height": 1024
    }
  }
}

คำตอบ (งานกำลังประมวลผล / อยู่ในคิว)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Processing",
    "waitNumber": 1,
    "percentage": 45,
    "input": {
      "imageUrl": "https://example.com/interior.jpg",
      "prompt": "modern warm remodel with clean built-in storage"
    },
    "output": null
  }
}

คำตอบ (งานล้มเหลว)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Failed",
    "waitNumber": 0,
    "percentage": 0,
    "input": {
      "imageUrl": "https://example.com/interior.jpg"
    },
    "output": null
  }
}

📊 สถานะงาน#

สถานะคำอธิบาย
Unprocessedงานถูกสร้างแล้วและกำลังรออยู่ในคิว
Processingงานกำลังดำเนินการอยู่
Successงานเสร็จสมบูรณ์
Failedงานล้มเหลวและไม่มีผลลัพธ์ที่ผลิตได้

ตรวจสอบสถานะเป็นระยะทุก 3-5 วินาที ดู API ข้อจำกัดงาน


❌ คำตอบข้อผิดพลาด#

รหัสชื่อคำอธิบาย
1011PARAM_ERRORข้อผิดพลาดพารามิเตอร์คำขอ
5002API_KEY_INVALIDคีย์ API ไม่ถูกต้องหรือไม่พบ
9010SCAN_TEXT_ERRORพรอมต์ไม่ผ่านการตรวจสอบเนื้อหา
9038PROHIBITED_CONTENTภาพที่สร้างมามีเนื้อหาต้องห้าม
9051COINS_NOT_ENOUGHเครดิตไม่เพียงพอ

สำหรับคำนิยามข้อผิดพลาดทั่วไปทั้งหมด ดู อ้างอิงรหัสข้อผิดพลาด