画像の操作
犬の画像を検索・一覧・アップロードします。
画像を検索
curl -H "x-api-key: YOUR-API-KEY" "https://api.thedogapi.com/v1/images/search?limit=2"
レスポンス例:
[
{
"id": "BJa4kxc4X",
"url": "https://cdn2.thedogapi.com/images/BJa4kxc4X.jpg",
"width": 1600,
"height": 1199,
"breeds": []
}
]
便利なフィルター
limit(1〜100)、page、order(ASC、DESC、RAND)、has_breeds=1、breed_ids=115,1、include_breeds=1、sub_id が使えます。例: German Shepherd の画像をランダムに2枚、品種情報付きで取得:
curl -H "x-api-key: YOUR-API-KEY" "https://api.thedogapi.com/v1/images/search?limit=2&breed_ids=115&include_breeds=1"
IDで画像を取得
curl -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/images/BJa4kxc4X
画像をアップロード
curl -X POST -H "x-api-key: YOUR-API-KEY" -F "file=@/path/dog.jpg" https://api.thedogapi.com/v1/images/upload
アップロードした画像はバックグラウンドで解析されます。解析結果を同期的に受け取るには https://upload.thedogapi.com/v1/images/upload-sync を使用してください(英語版 Image Uploads ページ参照)。
画像のステータスを確認
curl -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/images/IMAGE_ID/status
アップロードした画像を一覧
curl -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/images
アップロードした画像を削除
curl -X DELETE -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/images/IMAGE_ID
画像のラベルを取得
アップロードした画像に対してAIが生成したラベル(品種、カテゴリ)を返します。
curl -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/images/IMAGE_ID/labels