【发布时间】:2018-06-11 12:16:46
【问题描述】:
我想用 firebase 和 REST API 缩短 longLink,但我得到以下响应,但我不知道出了什么问题:
回复:
{
"error": {
"code": 400,
"message": "Long link is not parsable: https://www.google.de [https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]",
"status": "INVALID_ARGUMENT"
}
}
这就是我的做法:
请求:https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=(hereismyapikey)
身体看起来像这样:
{
"longDynamicLink": "https://www.google.de",
"suffix": {
"option": "SHORT"
}
}
我首先尝试使用我想要缩短的真实网址。同样的错误。比使用 google 和使用和不使用 http(s)。我没有选择,希望有人看到我在这里做错了什么。
编辑:完整的邮递员请求:
"item": [
{
"name": "shortLinks",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"longDynamicLink\": \"www.google.de\",\r\n \"suffix\": {\r\n \"option\": \"SHORT\"\r\n }\r\n}"
},
"url": {
"raw": "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=xxx",
"protocol": "https",
"host": [
"firebasedynamiclinks",
"googleapis",
"com"
],
"path": [
"v1",
"shortLinks"
],
"query": [
{
"key": "key",
"value": "xxx"
}
]
}
},
"response": []
}
]
【问题讨论】:
-
显示完整的请求,即 curl 请求或邮递员请求。隐藏您的 api 密钥
-
@UmarHussain II 添加了它
标签: javascript rest firebase firebase-dynamic-links