【发布时间】:2021-05-26 03:55:52
【问题描述】:
我正在遵循 Unsplash 文档中的触发指南。所以终点是:
GET /photos/:id/download
这是照片的示例响应:
{
"id": "LBI7cgq3pbM",
"width": 5245,
"height": 3497,
"color": "#60544D",
"urls": { ... },
"user": { ... },
"links": {
"self": "https://api.unsplash.com/photos/LBI7cgq3pbM",
"html": "https://unsplash.com/photos/LBI7cgq3pbM",
"download": "https://unsplash.com/photos/LBI7cgq3pbM/download", // don't use this property
"download_location": "https://api.unsplash.com/photos/LBI7cgq3pbM/download?ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM" // use this one ;)
}
}
“确保包含 URL 中包含的所有查询参数(如 ixid)。”
所以我的问题是什么是价值 od ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM 以及如何获得它?
【问题讨论】:
-
你需要将
links.download_location解析为一个URL。 Here is a good answer 在 Stack Overflow 上用于解析 URL 参数。
标签: javascript reactjs api rest