API文档 API Documentation

API版本1

存图库API V1,允许访客直接上传图片到存图库内。

API 调用

请求方法

可以使用POST或者GET来调用存图库的API V1,推荐使用POST请求方法。

请求URL

https://cuntuku.com/api/1/(action)/ (如果不能使用,请删除最后的"/")

参数

  • key API v1 key: 584bf3b4398f4e01f695cc0c50253110
  • action 你想做的事儿 [values: upload]。
  • source 不管是图片链接还是 base64编码图像字符串, 亦或者是您的本地文件。
  • format 设置返回格式 [values: json (default), redirect, txt]。

调用示例

GET https://cuntuku.com/api/1/upload/?key=584bf3b4398f4e01f695cc0c50253110&source=http://somewebsite/someimage.jpg&format=json

注:上传本地文件时,必须使用POST。

API响应

API v1 的响应将取决于不同 格式 参数:

  • json 显示所有的图像中的JSON格式上传的信息。[默认]
  • txt 返回text/plain格式的图片URL。
  • redirect 重定向到的图片URL。

当使用JSON时,响应将有标题状态代码,以便您可以轻松查看到请求是否正常。 它还将输出status_txtstatus_code属性。

例如响应(JSON)

{
		"status_code": 200,
		"success": {
			"message": "image uploaded",
			"code": 200
		},
		"image": {
			"name": "example",
			"extension": "png",
			"size": 53237,
			"width": 1151,
			"height": 898,
			"date": "2014-06-04 15:32:33",
			"date_gmt": "2014-06-04 19:32:33",
			"storage_id": null,
			"description": null,
			"nsfw": "0",
			"md5": "c684350d722c956c362ab70299735830",
			"storage": "datefolder",
			"original_filename": "example.png",
			"original_exifdata": null,
			"views": "0",
			"id_encoded": "L",
			"filename": "example.png",
			"ratio": 1.2817371937639,
			"size_formatted": "52 KB",
			"mime": "image/png",
			"bits": 8,
			"channels": null,
			"url": "http://127.0.0.1/images/2014/06/04/example.png",
			"url_viewer": "http://127.0.0.1/image/L",
			"thumb": {
				"filename": "example.th.png",
				"name": "example.th",
				"width": 160,
				"height": 160,
				"ratio": 1,
				"size": 17848,
				"size_formatted": "17.4 KB",
				"mime": "image/png",
				"extension": "png",
				"bits": 8,
				"channels": null,
				"url": "http://127.0.0.1/images/2014/06/04/example.th.png"
			},
			"medium": {
				"filename": "example.md.png",
				"name": "example.md",
				"width": 500,
				"height": 390,
				"ratio": 1.2820512820513,
				"size": 104448,
				"size_formatted": "102 KB",
				"mime": "image/png",
				"extension": "png",
				"bits": 8,
				"channels": null,
				"url": "http://127.0.0.1/images/2014/06/04/example.md.png"
			},
			"views_label": "views",
			"display_url": "http://127.0.0.1/images/2014/06/04/example.md.png",
			"how_long_ago": "moments ago"
		},
		"status_txt": "OK"
	}

例如响应(TXT)

http://127.0.0.1/images/2014/06/04/example.png

Kenzie revised and updated on May 12, 2017.

Edit or resize any image by clicking the image preview
Edit any image by touching the image preview
You can add more images from your computer or add image URLs.
You can add more images from your device, take a picture or add image URLs.
Uploading 0 bild (0% complete)
The queue is being uploaded, it should take just a few seconds to complete.
Uppladdning klar
Uploaded content added to . You can create a new album with the content just uploaded.
Uploaded content added to .
You can create a new album with the content just uploaded. You must create an account or sign in to save this content into your account.
No bild have been uploaded
Det blev ett fel och systemet kunde inte hantera din begärda åtgärd.
    eller avbrytavbryt kvarvarande
    Notis: Vissa bilder kunde inte laddas upp läs mer
    Kolla felrapporteringen för mer information.
    JPG PNG BMP GIF 1 MB