You can create short Dynamic Links with the Firebase Dynamic Links REST API. This API accepts either a long Dynamic Link or an object containing Dynamic Link parameters, and returns a URL like the following example:
https://example.page.link/WXYZ
Before you begin
- Get your API key. You will need an API key to authenticate your requests to the API. To find your API key:
- Open the Settings page of the Firebase console. If you are prompted to choose a project, select your Firebase project from the menu.
- Take note of the value of the Web API Key field.
- In the Firebase console, open the Dynamic Links section.
If you have not already accepted the terms of service and set a domain for your Dynamic Links, do so when prompted.
If you already have a Dynamic Links domain, take note of it. You need to provide a Dynamic Links domain when you programmatically create Dynamic Links.
Creating a short Dynamic Link
POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key Content-Type: application/json { "longDynamicLink": "https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios" }
Create a short link from parameters
POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key Content-Type: application/json { "dynamicLinkInfo": { "domainUriPrefix": "https://example.page.link", "link": "https://www.example.com/", "androidInfo": { "androidPackageName": "com.example.android" }, "iosInfo": { "iosBundleId": "com.example.ios" } } }
Get Analysis statistics for a single Dynamic Link
For example, to retrieve statistics from the last 7 days for the short link https://example.page.link/wXYz
: