This question is about what I think is a discrepancy between the REST API (from the docs anyway), and the behaviour afforded through the Firebase console.
Here's the console:
Yet when I look at the REST API docs, I don't see any way to follow step (1) from the Firebase console. I don't see any way to set up a short URL link, rather it looks like it will be generated. This is a shame because I wanted to generate guessable links. For reference, here is their specification sans platform-specific info keys (eg "iosInfo"):
{
"dynamicLinkInfo": {
"domainUriPrefix": string,
"link": string,
},
"suffix": {
"option": "SHORT" or "UNGUESSABLE"
}
}
Is there a way to copy the console behaviour through the API?
I was able to create persisting link in firebase dynamic link using API in node. I did the following.
import {google} from "googleapis";
const oauth2Client = new google.auth.GoogleAuth({
keyFile: "path to service account json file",
scopes: ['https://www.googleapis.com/auth/firebase']
})
const data = {
"dynamicLinkInfo": {
"domainUriPrefix": "https://myapp.page.link",
"link": "my deeplink",
"androidInfo": {
"androidFallbackLink": "",
"androidLink": "",
"androidMinPackageVersionCode": "",
"androidPackageName": bundleName // android package name, fe my.app.io
},
"iosInfo": {
"iosAppStoreId": `${isi}`, // app store app id
"iosBundleId": bundleName, // ios app bundle id, fe my.app.io
"iosCustomScheme": "",
"iosFallbackLink": "",
"iosIpadBundleId": "",
"iosIpadFallbackLink": ""
},
"navigationInfo": {
"enableForcedRedirect": false
},
"analyticsInfo": {
"googlePlayAnalytics": {
"utmCampaign": "",
"utmMedium": "",
"utmSource": ""
},
"itunesConnectAnalytics": {
"at": "",
"ct": "",
"mt": "",
"pt": ""
}
},
"socialMetaTagInfo": {
"socialDescription": "",
"socialImageLink": "",
"socialTitle": ""
},
},
"name": "Link name column from FDL",
"suffix": {
"customSuffix": "URL_prefix_during_link_creation_from_FDL, "option": "CUSTOM"
}
}
oauth2Client.request({
method: "POST",
url: "https://firebasedynamiclinks.googleapis.com/v1/managedShortLinks:create",
data: data
})
Links:
As far as I know, you cannot use any direct REST API since you need appropriate oauth2 access_token for specific scope. I was trying to spoof FDL requests and reflect it behaviour without success, but this works.