根据此文档,我想向我的动态链接添加一些社交元标记信息:
https://firebase.google.com/docs/reference/dynamic-links/link-shortener
我必须在参数中添加socialMetaTagInfo。
但是当我这样做时,我收到错误 400 并显示以下消息:
message: "Invalid JSON payload received. Unknown name "socialMetaTagInfo": Cannot find field." status: "INVALID_ARGUMENT"
我的代码如下:
var params = {
"longDynamicLink": "https://myapp.page.link/?link=https://www.google.com",
"socialMetaTagInfo": {
"socialTitle": "test title",
"socialDescription": "test description"
},
"suffix": {
"option": "SHORT"
}
}
$.ajax({
url: 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=MYAPIKEY',
type: 'POST',
data: JSON.stringify(params),
dataType: 'json',
contentType: 'application/json',
success: function (response) {
console.log(response.shortLink);
},
error: function () {
console.log("error");
}
});
});
最佳答案
var params = {
"dynamicLinkInfo": "https://myapp.page.link",
"link": "https://www.google.com",
"socialMetaTagInfo": {
"socialTitle": "test title",
"socialDescription": "test description"
},
"suffix": {
"option": "SHORT"
}
}
关于javascript - Firebase 动态链接 Rest API : Unknown name "socialMetaTagInfo",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57307330/