เอกสาร API ออกแบบภูมิทัศน์#
URL พื้นฐาน:
https://api.ideal.house
เวอร์ชัน: v1
อัปเดต: 2026-05-21
📖 ภาพรวม#
API ออกแบบภูมิทัศน์ ปรับปรุงหรือออกแบบใหม่พื้นที่ภูมิทัศน์ภายนอกจากภาพต้นฉบับ รองรับคำแนะนำข้อความ ตัวเลือกสไตล์สวน องค์ประกอบภูมิทัศน์ และโหมดโมเดล
เวิร์กโฟลว์เป็นแบบอสังโครนัส:
- สร้างงาน — ส่ง
imageUrlและพารามิเตอร์ตัวเลือก จากนั้นรับtaskId - ตรวจสอบผลลัพธ์ — ใช้
taskIdเพื่อดึงสถานะงานและภาพที่สร้าง
🔐 การยืนยันตัวตน#
| หัวข้อ | ค่า |
|---|---|
APIKEY | your_api_key_here |
💰 การหักเครดิต#
[!WARNING] เครดิตจะถูกหักเมื่อสร้างงานสำเร็จ หากงาน ล้มเหลว ในที่สุด เครดิตที่ถูกหักจะ ถูกคืนอัตโนมัติ
เครดิตไม่เพียงพอจะคืนรหัสข้อผิดพลาด9051ดู อ้างอิงการหักเครดิต
โมเดล (modelType) | เครดิตที่ถูกหัก |
|---|---|
Flash | 1 เครดิต |
Base | 3 เครดิต |
Pro | 10 เครดิต |
หากไม่ได้ให้ modelType จะใช้ Base เป็นค่าเริ่มต้น
🎨 ตัวเลือกสไตล์#
API นี้รองรับพารามิเตอร์สไตล์แบบไม่บังคับที่คืนโดยจุดปลายทาง API การตั้งค่าสไตล์
การใช้งาน:
GET /api/v1/style/landscaping/getStyles
| กลุ่มสไตล์ | ฟิลด์คำขอ | คำอธิบาย |
|---|---|---|
gardenStyle | sceneId | ตัวเลือกสไตล์สวนหรือภูมิทัศน์ |
elements | sceneElementId | ตัวเลือกองค์ประกอบภูมิทัศน์ รองรับหลายตัวเลือก ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2 |
แต่ละตัวเลือกประกอบด้วย name, id และ url ส่ง id ของตัวเลือกไปยังฟิลด์คำขอที่สอดคล้องกัน
📌 เอนด์พอยต์ API#
1. สร้างงานออกแบบภูมิทัศน์#
เอนด์พอยต์
POST /api/v1/landscaping/generate
หัวข้อความขอ
| หัวข้อ | จำเป็น | คำอธิบาย |
|---|---|---|
APIKEY | ✅ ใช่ | คีย์การยืนยันตัวตน API ของคุณ |
Content-Type | ✅ ใช่ | application/json |
เนื้อหาข้อความขอ
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
imageUrl | string | ✅ ใช่ | URL ของภาพภูมิทัศน์ต้นฉบับ |
prompt | string | ❌ ไม่บังคับ | คำแนะนำข้อความสำหรับผลลัพธ์ที่ต้องการ |
sceneId | string | ❌ ไม่บังคับ | ID สไตล์สวนจากตัวเลือกสไตล์ gardenStyle |
sceneElementId | string | ❌ ไม่บังคับ | ID องค์ประกอบภูมิทัศน์จากตัวเลือกสไตล์ elements รองรับหลาย ID ที่เชื่อมด้วยเครื่องหมายจุลภาค เช่น id1,id2 |
modelType | string | ❌ ไม่บังคับ | Enum: Flash, Base, Pro. ค่าเริ่มต้นเป็น Base |
เฉพาะ
imageUrlเท่านั้นที่จำเป็น ฟิลด์อื่นทั้งหมดเป็นตัวเลือก
🖼️ ข้อกำหนดของภาพ: ภาพต้นฉบับและภาพอ้างอิงทั้งหมดต้องเป็น JPG/JPEG, PNG หรือ WebP แต่ละภาพต้องไม่เกิน 20 MB โดยมีขนาดตั้งแต่ 128 × 128 px ถึง 6,000 × 6,000 px (รวมขอบเขต) ภาพที่เกินขนาดพิกเซลสูงสุดจะถูกย่อสัดส่วนอัตโนมัติให้พอดีกับ 6,000 × 6,000 px ก่อนการประมวลผล URLs ของภาพต้องเข้าถึงได้โดยตรงโดยเซิร์ฟเวอร์ API
📥 ตัวอย่างคำขอ#
cURL
curl -X POST "https://api.ideal.house/api/v1/landscaping/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/backyard.jpg",
"prompt": "lush modern garden with clean stone paths",
"sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
"sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
"modelType": "Base"
}'
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class LandscapingApiExample {
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/backyard.jpg",
"prompt": "lush modern garden with clean stone paths",
"sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
"sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
"modelType": "Base"
}
""";
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/landscaping/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/backyard.jpg",
"prompt": "lush modern garden with clean stone paths",
"sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
"sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
"modelType": "Base"
}
response = requests.post(
f"{BASE_URL}/api/v1/landscaping/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 createLandscapingTask() {
try {
const response = await axios.post(
`${BASE_URL}/api/v1/landscaping/generate`,
{
imageUrl: 'https://example.com/backyard.jpg',
prompt: 'lush modern garden with clean stone paths',
sceneId: 'Landscape Design_Landscape Style_Mid-Century Modern Pool',
sceneElementId: 'Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover',
modelType: 'Base'
},
{
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);
}
}
createLandscapingTask();
📤 คำตอบ#
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
2. รับผลลัพธ์งาน#
เอนด์พอยต์
GET /api/v1/landscaping/result
หัวข้อความขอ
| หัวข้อ | จำเป็น | คำอธิบาย |
|---|---|---|
APIKEY | ✅ ใช่ | คีย์การยืนยันตัวตน API ของคุณ |
พารามิเตอร์ควอรี
| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
taskId | long | ✅ ใช่ | ID งานที่ส่งกลับจากเอนด์พอยต์สร้างงาน |
📥 ตัวอย่างคำขอ#
cURL
curl -X GET "https://api.ideal.house/api/v1/landscaping/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class LandscapingResultExample {
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/landscaping/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/landscaping/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 pollLandscapingResult(taskId) {
const headers = { APIKEY: API_KEY };
while (true) {
const response = await axios.get(
`${BASE_URL}/api/v1/landscaping/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));
}
}
pollLandscapingResult(1234567890123456789n);
📤 ตัวอย่างคำตอบ#
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Success",
"waitNumber": 0,
"percentage": 100,
"input": {
"imageUrl": "https://example.com/backyard.jpg",
"prompt": "lush modern garden with clean stone paths",
"sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
"sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
"modelType": "Base"
},
"output": {
"resultUrl": "https://cdn.ideal.house/output/landscaping_result.jpg",
"width": 1024,
"height": 1024
}
}
}
คำตอบ (งานกำลังประมวลผล / อยู่ในคิว)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 1,
"percentage": 45,
"input": {
"imageUrl": "https://example.com/backyard.jpg",
"modelType": "Base"
},
"output": null
}
}
คำตอบ (งานล้มเหลว)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Failed",
"waitNumber": 0,
"percentage": 0,
"input": {
"imageUrl": "https://example.com/backyard.jpg",
"modelType": "Base"
},
"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 | เครดิตไม่เพียงพอ |
สำหรับคำนิยามข้อผิดพลาดทั่วไปทั้งหมด ดู อ้างอิงรหัสข้อผิดพลาด