POST 将图片链接添加至 Eagle 应用,如果需要一次添加多个项目,可以改用 /api/item/addFromURLs 已获得更高处理性能。

参数:

参数 说明
url 必填,欲添加图片链接,支持 httphttpsbase64
name 必填,欲添加图片名
website 图片来源网址
tags 图片标签
annotation 图片注释
modificationTime 图片创建时间,可以用此参数控制添加后在 Eagle 的排列顺序
folderId 如果带有此参数,图片将会添加到指定文件夹
headers 选填,自定义 HTTP headers 属性,可用来绕过特定网站保护机制

范例代码:

  1. var data = {
  2. "url": "https://cdn.dribbble.com/users/674925/screenshots/12020761/media/6420a7ec85751c11e5254282d6124950.png",
  3. "name": "Work",
  4. "website": "https://dribbble.com/shots/12020761-Work",
  5. "tags": ["Illustration", "Design"],
  6. "modificationTime": 1591325171766,
  7. "headers": {
  8. "referer": "dribbble.com"
  9. }
  10. };
  11. var requestOptions = {
  12. method: 'POST',
  13. body: JSON.stringify(data),
  14. redirect: 'follow'
  15. };
  16. fetch("http://localhost:41595/api/item/addFromURL", requestOptions)
  17. .then(response => response.json())
  18. .then(result => console.log(result))
  19. .catch(error => console.log('error', error));

返回结果:

json { "status": "success" }ss