Arbeiten mit Bildern
Durchsuche, liste und lade Katzenfotos hoch.
Bilder suchen
curl -H "x-api-key: YOUR-API-KEY" "https://api.thecatapi.com/v1/images/search?limit=2"
Beispielantwort:
[
{
"id": "KWdLHmOqc",
"url": "https://cdn2.thecatapi.com/images/KWdLHmOqc.jpg",
"width": 3114,
"height": 2609,
"breeds": []
}
]
Nützliche Filter
limit (1–100), page, order (ASC, DESC, RAND), has_breeds=1, breed_ids=abys,beng, include_breeds=1 und sub_id. Zum Beispiel zwei zufällige Abyssinian-Bilder mit Rassedetails:
curl -H "x-api-key: YOUR-API-KEY" "https://api.thecatapi.com/v1/images/search?limit=2&breed_ids=abys&include_breeds=1"
Bild per ID abrufen
curl -H "x-api-key: YOUR-API-KEY" https://api.thecatapi.com/v1/images/KWdLHmOqc
Bild hochladen
curl -X POST -H "x-api-key: YOUR-API-KEY" -F "file=@/path/cat.jpg" https://api.thecatapi.com/v1/images/upload
Der Upload wird im Hintergrund analysiert. Für eine synchrone Antwort mit der vollständigen Analyse nutze https://upload.thecatapi.com/v1/images/upload-sync (siehe die englische Seite Image Uploads).
Bildstatus prüfen
curl -H "x-api-key: YOUR-API-KEY" https://api.thecatapi.com/v1/images/IMAGE_ID/status
Deine hochgeladenen Bilder auflisten
curl -H "x-api-key: YOUR-API-KEY" https://api.thecatapi.com/v1/images
Hochgeladenes Bild löschen
curl -X DELETE -H "x-api-key: YOUR-API-KEY" https://api.thecatapi.com/v1/images/IMAGE_ID
Bild-Labels abrufen
Liefert die von der KI erkannten Labels (Rassen, Kategorien) für eines deiner hochgeladenen Bilder.
curl -H "x-api-key: YOUR-API-KEY" https://api.thecatapi.com/v1/images/IMAGE_ID/labels