Integrationsanleitungen
Abfragen und Ergebnisse
Anfrage
Status über /tasks/get abfragen. /tasks/get_result liefert vor Abschluss code 41006, nach Fehler ggf. code=0 und status=FAILED.
cURL
curl -X POST "https://api.kusa.pics/api/go/b2b/tasks/get" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KUSART_API_KEY" \
-d '{
"task_id": "YOUR_TASK_ID"
}'Erstelle die Aufgabe nur einmal und speichere die erhaltene task_id. Frage den Fortschritt mit derselben ID ab, ohne die Aufgabe erneut zu erstellen.
Antwortstruktur
HTTP-Status und Antwort prüfen. code=0 bestätigt die Anfrage; Generierung erst bei data.status=COMPLETED erfolgreich. Auch FAILED kann code=0 haben.
JSON
{
"code": 0,
"message": "Success",
"data": {
"task_id": "00000000-0000-0000-0000-000000000000",
"task_type": "ANIMA_TEXT_TO_IMAGE",
"status": "COMPLETED",
"result": {
"images": [
{
"display_url": "https://cdn.kusa.pics/generated/example.png",
"width": 1024,
"height": 1024,
"index": 0
}
],
"image_count": 1
}
}
}JSON
{
"code": 41006,
"message": "Task is not yet completed"
}