API集成教程

您可以将本站API集成在自己的站点或工具中使用,本文将介绍集成工具PicGo及API的使用.

一、集成PicGo

1、下载PicGo 地址:https://github.com/Molunerfinn/PicGo/releases ,下载后安装。

2、菜单“插件设置”搜索插件"chevereto"安装

3、插件设置,配置插件"chevereto",URL为https://www.picgo.net/api/1/upload

个人中心中点击"设置"-"API",获取密钥,此时密钥仅显示一次,请牢记,再次获取上一次的密钥将作废。如图:

设置URL为上面您的API地址,Key中填写您在API中获取到的密钥保存,并设置为默认图床,自此大功告成 软件切换到上传区尝试下。

二、API调用

上面已提及API地址及密钥,在此我们将介绍程序调用API接口和使用,下面是Apifox请求,如图:

请求方式POST,具体的参数可看图,这里不做详细讲解,开发者可根据自身需要开发,如下为返回参数。

{ "status_code": 200, "success": { "message": "image uploaded", "code": 200 }, "image": { "name": "donate-pay923c98fb4e3a32ab", "extension": "jpg", "size": "59983", "width": "700", "height": "508", "date": "2022-04-16 21:38:22", "date_gmt": "2022-04-16 13:38:22", "title": "donate pay", "description": null, "nsfw": "0", "storage_mode": "datefolder", "md5": "071f9657951376db9367a35a51d39bf8", "source_md5": null, "original_filename": "donate-pay.jpg", "original_exifdata": "{\"FileName\":\"donate-pay.jpg\",\"FileDateTime\":\"1650116299\",\"FileSize\":\"55730\",\"FileType\":\"2\",\"MimeType\":\"image\\/jpeg\",\"SectionsFound\":\"ANY_TAG, IFD0, THUMBNAIL, EXIF\",\"COMPUTED\":{\"html\":\"width=\\\"700\\\" height=\\\"508\\\"\",\"Height\":\"508\",\"Width\":\"700\",\"IsColor\":\"1\",\"ByteOrderMotorola\":\"1\",\"Thumbnail.FileType\":\"2\",\"Thumbnail.MimeType\":\"image\\/jpeg\"},\"Orientation\":\"1\",\"XResolution\":\"720000\\/10000\",\"YResolution\":\"720000\\/10000\",\"ResolutionUnit\":\"2\",\"Software\":\"Adobe Photoshop CS4 Windows\",\"DateTime\":\"2021:06:10 22:03:09\",\"Exif_IFD_Pointer\":\"164\",\"THUMBNAIL\":{\"Compression\":\"6\",\"XResolution\":\"72\\/1\",\"YResolution\":\"72\\/1\",\"ResolutionUnit\":\"2\",\"JPEGInterchangeFormat\":\"302\",\"JPEGInterchangeFormatLength\":\"6734\"},\"ColorSpace\":\"1\",\"ExifImageWidth\":\"700\",\"ExifImageLength\":\"508\"}", "views": "0", "category_id": null, "chain": "7", "thumb_size": "10715", "medium_size": "41143", "expiration_date_gmt": null, "likes": "0", "is_animated": "0", "is_approved": "1", "is_360": "0", "file": { "resource": { "type": "path" } }, "id_encoded": "W27Pb", "filename": "donate-pay923c98fb4e3a32ab.jpg", "mime": "image/jpeg", "url": "https://img.picgo.net/2022/04/16/donate-pay923c98fb4e3a32ab.jpg", "url_viewer": "https://www.ipicbed.com/image/donate-pay.W27Pb", "url_short": "https://www.ipicbed.com/image/W27Pb", "image": { "filename": "donate-pay923c98fb4e3a32ab.jpg", "name": "donate-pay923c98fb4e3a32ab", "mime": "image/jpeg", "extension": "jpg", "url": "https://img.picgo.net/2022/04/16/donate-pay923c98fb4e3a32ab.jpg", "size": "59983" }, "thumb": { "filename": "donate-pay923c98fb4e3a32ab.th.jpg", "name": "donate-pay923c98fb4e3a32ab.th", "mime": "image/jpeg", "extension": "jpg", "url": "https://img.picgo.net/2022/04/16/donate-pay923c98fb4e3a32ab.th.jpg", "size": "10715" }, "medium": { "filename": "donate-pay923c98fb4e3a32ab.md.jpg", "name": "donate-pay923c98fb4e3a32ab.md", "mime": "image/jpeg", "extension": "jpg", "url": "https://img.picgo.net/2022/04/16/donate-pay923c98fb4e3a32ab.md.jpg", "size": "41143" }, "size_formatted": "60 KB", "display_url": "https://img.picgo.net/2022/04/16/donate-pay923c98fb4e3a32ab.md.jpg", "display_width": "500", "display_height": 363, "views_label": "views", "likes_label": "likes", "how_long_ago": "3 seconds ago", "date_fixed_peer": "2022-04-16 13:38:22", "title_truncated": "donate pay", "title_truncated_html": "donate pay", "is_use_loader": false, "delete_url": "https://www.ipicbed.com/image/W27Pb/delete/b77896cd9f056b018cb1cf5478916da60237fd367390dca2" }, "status_txt": "OK" }

Customize upload by clicking on any preview
Customize upload by touching on any preview
Uploading 0 files (0% complete)
The queue is being uploaded, it should take just a few seconds to complete.
Upload complete
Uploaded content added to . You can create new album with the content just uploaded.
Uploaded content added to .
You can create new album with the content just uploaded. You must create an account or sign in to save this content into your account.
No file have been uploaded
Some errors have occurred and the system couldn't process your request.
    or cancelcancel remaining
    Note: Some files couldn't be uploaded. learn more
    Check the error report for more information.