POST
将多张图片链接添加至 Eagle 应用。
参数:
参数 |
说明 |
items |
由多个 item 组成的 array 物件(参考下方说明) |
folderId |
如果带有此参数,图片将会添加到指定文件夹 |
**
Item 参数说明:
参数 |
说明 |
url |
必填,欲添加图片链接,支持 http 、 https 、 base64 |
name |
必填,欲添加图片名 |
website |
图片来源网址 |
annotation |
图片注释 |
tags |
图片标签 |
modificationTime |
图片创建时间,可以用此参数控制添加后在 Eagle 的排列顺序 |
headers |
选填,自定义 HTTP headers 属性,可用来绕过特定网站保护机制 |
**
范例代码:
var data = {
"items": [
{
"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": 1591325171767,
"headers": {
"referer": "dribbble.com"
}
},
{
"url": "https://cdn.dribbble.com/users/674925/screenshots/12061400/media/71da9ba40c47f09d8cd6953d661e61fd.png",
"name": "Work2",
"website": "https://dribbble.com/shots/12061400-work2",
"tags": ["Illustration", "Design"],
"modificationTime": 1591325171766,
"headers": {
"referer": "dribbble.com"
}
}
],
"folderId": "KAY6NTU6UYI5Qa"
};
var requestOptions = {
method: 'POST',
body: JSON.stringify(data),
redirect: 'follow'
};
fetch("http://localhost:41595/api/item/addFromURLs", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
返回结果:
{
"status": "success"
}