API バージョン 1.1

API を使用すると、アプリケーションからファイルをアップロードし、アップロード機能を組み込むことができます。

キー

設定 で自分の API キーを取得できます。

リクエスト 方法

API V1 は POST または GET メソッドで呼び出せます。

POST メソッドを推奨します。

リクエスト URL

https://imgcc.cloud/api/1/upload

認証・認可

API V1.1 では、X-API-Key ヘッダーに API キーを指定して認証できます。

X-API-Key: chv_key_here

パラメーター

source

バイナリファイル、Base64 データ、または画像の URL。

key (任意)

API キー。ヘッダーで認証情報を送れない場合に、このパラメーターを使用できます。

title (任意)

ファイルのタイトル。省略した場合はメタデータから自動取得します。

description (任意)

ファイルの説明。省略した場合はメタデータから自動取得します。

tags (任意)

ファイルのタグ。複数のタグはカンマで区切ります。

album_id (任意)

保存先のアルバム ID。API キーの所有者が所有するアルバムを指定してください。

category_id (任意)

ファイルに割り当てるカテゴリーの ID。

width (任意)

サイズ変更後の幅。高さは自動計算されます。

expiration (任意)

ファイルを自動削除するまでの期間を日時の間隔形式で指定します。例えば PT5M は 5 分後、P3D は 3 日後です。

format (任意)

レスポンス形式 [json, redirect, txt]。

use_file_date (省略可、管理者のみ)

アップロード日時の代わりに EXIF の撮影日時を使用するかどうか [0, 1]。

リクエスト例

curl --fail-with-body -X POST \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "source=@image.jpeg" \ https://imgcc.cloud/api/1/upload

API レスポンス

API V1 の応答形式は format パラメーター(json、txt、redirect)によって変わります。既定の JSON レスポンスには status_txt と status_code が含まれます。

レスポンス例 (JSON)

{
  "status_code": 200,
  "success": {
    "message": "file uploaded",
    "code": 200
  },
  "image": {
    "name": "Badgers-animated-music-video",
    "extension": "mp4",
    "size": 3011299,
    "width": 496,
    "height": 360,
    "date": "2024-10-10 16:58:00",
    "date_gmt": "2024-10-10 19:58:00",
    "title": "Badgers animated music video MrWeebl",
    "tags": [],
    "description": null,
    "storage_mode": "datefolder",
    "checksum": "7a120d5c28de264bdbb934f023a628fd",
    "source_checksum": null,
    "original_filename": "Badgers _ animated music video _ MrWeebl.mp4",
    "original_exifdata": null,
    "views": 0,
    "category_id": null,
    "chain": 21,
    "thumb_size": 21212,
    "medium_size": 0,
    "frame_size": 19804,
    "expiration_date_gmt": "2024-10-10 20:28:00",
    "likes": 0,
    "is_animated": 0,
    "is_approved": 1,
    "is_360": 0,
    "duration": 73,
    "type": "video",
    "tags_string": "",
    "file": {
      "resource": {
        "type": "url"
      }
    },
    "id_encoded": "ZfGd",
    "filename": "Badgers-animated-music-video.mp4",
    "mime": "video/mp4",
    "url": "http://localhost/images/2024/10/10/Badgers-animated-music-video.mp4",
    "ratio": 1.3777777777777778,
    "size_formatted": "3 MB",
    "frame": {
      "filename": "Badgers-animated-music-video.fr.jpeg",
      "name": "Badgers-animated-music-video.fr",
      "mime": "image/jpeg",
      "extension": "jpeg",
      "url": "http://localhost/images/2024/10/10/Badgers-animated-music-video.fr.jpeg",
      "size": 19804
    },
    "image": {
      "filename": "Badgers-animated-music-video.mp4",
      "name": "Badgers-animated-music-video",
      "mime": "video/mp4",
      "extension": "mp4",
      "url": "http://localhost/images/2024/10/10/Badgers-animated-music-video.mp4",
      "size": 3011299
    },
    "thumb": {
      "filename": "Badgers-animated-music-video.th.jpeg",
      "name": "Badgers-animated-music-video.th",
      "mime": "image/jpeg",
      "extension": "jpeg",
      "url": "http://localhost/images/2024/10/10/Badgers-animated-music-video.th.jpeg",
      "size": 21212
    },
    "url_frame": "http://localhost/images/2024/10/10/Badgers-animated-music-video.fr.jpeg",
    "medium": {
      "filename": null,
      "name": null,
      "mime": null,
      "extension": null,
      "url": null
    },
    "duration_time": "01:13",
    "url_viewer": "http://localhost/clip/Badgers-animated-music-video-MrWeebl.ZfGd",
    "path_viewer": "/clip/Badgers-animated-music-video-MrWeebl.ZfGd",
    "url_short": "http://localhost/clip/ZfGd",
    "display_url": "http://localhost/images/2024/10/10/Badgers-animated-music-video.fr.jpeg",
    "display_width": 496,
    "display_height": 360,
    "views_label": "views",
    "likes_label": "likes",
    "how_long_ago": "moments ago",
    "date_fixed_peer": "2024-10-10 19:58:00",
    "title_truncated": "Badgers animated music vi...",
    "title_truncated_html": "Badgers animated music vi...",
    "is_use_loader": false,
    "display_title": "Badgers animated music video MrWeebl",
    "delete_url": "http://localhost/clip/ZfGd/delete/e8b07479818bc58d3b9849c431e9c2b28827ccce7809ed4f"
  },
  "status_txt": "OK"
}

レスポンス例 (text)

http://localhost/images/2024/10/10/Badgers-animated-music-video.mp4

レスポンス例 (redirect)

Location: /clip/Badgers-animated-music-video-MrWeebl.ZfGd