POST 将图片链接添加至 Eagle 应用,如果需要一次添加多个项目,可以改用 /api/item/addFromURLs 已获得更高处理性能。
参数:
| 参数 | 说明 |
|---|---|
| url | 必填,欲添加图片链接,支持 http、 https、 base64 |
| name | 必填,欲添加图片名 |
| website | 图片来源网址 |
| tags | 图片标签 |
| annotation | 图片注释 |
| modificationTime | 图片创建时间,可以用此参数控制添加后在 Eagle 的排列顺序 |
| folderId | 如果带有此参数,图片将会添加到指定文件夹 |
| headers | 选填,自定义 HTTP headers 属性,可用来绕过特定网站保护机制 |
范例代码:
var data = {"url": "https://cdn.dribbble.com/users/674925/screenshots/12020761/media/6420a7ec85751c11e5254282d6124950.png","name": "Work","website": "https://dribbble.com/shots/12020761-Work","tags": ["Illustration", "Design"],"modificationTime": 1591325171766,"headers": {"referer": "dribbble.com"}};var requestOptions = {method: 'POST',body: JSON.stringify(data),redirect: 'follow'};fetch("http://localhost:41595/api/item/addFromURL", requestOptions).then(response => response.json()).then(result => console.log(result)).catch(error => console.log('error', error));
返回结果:
{"status": "success"}
