bre*_*two 4 javascript rest firebase firebase-dynamic-links
我想使用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"
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我的方法:
请求:https : //firebasedynamiclinks.googleapis.com/v1/shortLinks ? key =(hereismyapikey)
身体看起来像这样:
{
"longDynamicLink": "https://www.google.de",
"suffix": {
"option": "SHORT"
}
}
Run Code Online (Sandbox Code Playgroud)
我首先尝试使用要缩短的真实网址。同样的错误。比起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": []
}
]
Run Code Online (Sandbox Code Playgroud)
您正在使用创建动态链接的简单方法,该方法大致等于手动创建动态链接:https : //firebase.google.com/docs/dynamic-links/create-manually
在文档中,如果您仔细查看了示例中传递的链接,您将看到以下模式:
https://your_subdomain.page.link/?link=your_deep_link&apn=package_name[&amv=minimum_version][&afl=fallback_link]
Run Code Online (Sandbox Code Playgroud)
因此,您应该根据此设置输入链接的格式或使用在json中对参数进行细分的参数进行创建:
https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters
这是从参数创建Firebase动态链接的api参考:
https://firebase.google.com/docs/reference/dynamic-links/link-shortener#parameters
| 归档时间: |
|
| 查看次数: |
2140 次 |
| 最近记录: |