Get Link By Prefix
The Get Link by Prefix endpoint allows you to retrieve the details of a specific AppLink using its urlPrefix and shortId. It uses the POST method and returns a JSON response containing all the information associated with the requested link.
- Before getting started, ensure your AppLink Configuration is set up.
Endpoint
This is the POST URL you’ll use to get the AppLink.
https://api.appsonair.link/api/v1/applinks/get-by-prefix
Request Headers
See Authorization for the required authentication headers.
Request Payload
The request payload defines the data required to get the AppLink. The payload must be sent in JSON format within the body of the request.
{
"data": {
"urlPrefix": "example.appsonair.link", // Shouldn't contain http or https
"shortId": "XXXXX"
}
}
AppLinkParams Properties
Defines all parameters used to get an AppLink.
| Key | Type | Description |
|---|---|---|
| urlPrefix | String | The domain prefix of the AppLink Example: app.domain.com. |
| shortId | String | The unique identifier (Short ID) for the AppLink. |
Usage
Example Request
curl --location 'https://api.appsonair.link/api/v1/applinks/get-by-prefix' \
--header 'x-api-key: XXXXXXXXXXXXXXXXXXXX' \
--header 'x-app-key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"urlPrefix": "example.appsonair.link",
"shortId": "XXXXX"
}
}'
Code Snippets
- JavaScript
- Python
- Java
- PHP
const fetch = require("node-fetch");
const url = "https://api.appsonair.link/api/v1/applinks/get-by-prefix";
const headers = {
"x-api-key": "XXXXXXXXXXXXXXXXXXXX",
"x-app-key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"Content-Type": "application/json"
};
const body = {
data: {
urlPrefix: "example.appsonair.link", // Shouldn't contain http or https
shortId: "XXXXX"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => {
console.log("Success:", data);
})
.catch(error => {
console.error("Error:", error);
});
import requests
import json
url = "https://api.appsonair.link/api/v1/applinks/get-by-prefix"
headers = {
"x-api-key": "XXXXXXXXXXXXXXXXXXXX",
"x-app-key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"Content-Type": "application/json"
}
payload = {
"data": {
"urlPrefix": "example.appsonair.link", # Shouldn't contain http or https
"shortId": "XXXXX"
}
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
print("Success:", response.json())
else:
print("Error:", response.status_code, response.text)
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class GetAppLinkByPrefix {
public static void main(String[] args) {
try {
String url = "https://api.appsonair.link/api/v1/applinks/get-by-prefix";
URL obj = new URL(url);
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
// Set request method and headers
conn.setRequestMethod("POST");
conn.setRequestProperty("x-api-key", "XXXXXXXXXXXXXXXXXXXX");
conn.setRequestProperty("x-app-key", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
// JSON payload
String jsonPayload = "{\n" +
" \"data\": {\n" +
" \"urlPrefix\": \"example.appsonair.link\",\n" +
" \"shortId\": \"XXXXX\"\n" +
" }\n" +
"}";
// Send request
try (OutputStream os = conn.getOutputStream()) {
os.write(jsonPayload.getBytes("UTF-8"));
}
// Read response
int responseCode = conn.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Success: " + response.toString());
} else {
System.out.println("Error: " + responseCode + " " + response.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
<?php
$url = "https://api.appsonair.link/api/v1/applinks/get-by-prefix";
$headers = [
"x-api-key: XXXXXXXXXXXXXXXXXXXX",
"x-app-key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"Content-Type: application/json"
];
$payload = [
"data" => [
"urlPrefix" => "example.appsonair.link", // Shouldn't contain http or https
"shortId" => "XXXXX"
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
echo "Success: " . $response;
} else {
echo "Error ($httpCode): " . $response;
}
?>
Response
The API returns either a success response with the details of the AppLink or an error response if the request is invalid. The examples below illustrate both scenarios.
Success Response
If the request is successful, the API returns a 200 status code along with details of the AppLink.
{
"id": "XXXXXXXXXXXXXXXXXXXXXX",
"link": "https://custom-domain.com/XXXXX",
"brandedLink": "https://example.appsonair.link/XXXXX",
"data": {
"name": "AppsOnAir",
"url": "https://appsonair.com",
"shortId": "XXXXX",
"socialMeta": {
"title": "Link title",
"description": "Link description",
"imageUrl": "https://image.png"
},
"appsFlyer": {
"channel": "appsonair",
"campaignId": "01",
"campaign": "test",
"subs": ["sub1", "sub2", "sub3", "sub4", "sub5"],
"metaTitle": "metaTitle",
"metaDescription": "metaDescription"
},
"attributionTtl": 3600
}
}
The link field is returned only if a custom domain is configured.
appsFlyer and attributionTtl are returned only for links that were created with them.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the AppLink. |
link | String | URL generated by AppLink. This field is returned only if a custom domain is configured. |
brandedLink | String | Branded URL generated using your configured domain. Always returned. |
data.name | String | Name given to the AppLink. |
data.url | String | Original URL that the AppLink redirects to. |
data.shortId | String | Short identifier for the link, automatically generated if not provided. |
data.socialMeta.title | String | Title of the link used in social media previews. |
data.socialMeta.description | String | Description of the link used in social media previews. |
data.socialMeta.imageUrl | String | Image URL displayed when the link is shared on social platforms. |
data.appsFlyer | Object | AppsFlyer attribution parameters attached to the link. Refer to AppsFlyer Fields. |
data.attributionTtl | Number | Attribution window configured for the link, in seconds. |
AppsFlyer Fields
| Field | Type | Description |
|---|---|---|
channel | String | The media source or channel driving traffic to this link. |
campaignId | String | Unique identifier for the marketing campaign. |
campaign | String | Human-readable name of the marketing campaign. |
subs | String[] | Sub-parameters used for granular tracking. Defaults to the link's shortId as sub1. |
metaTitle | String | Title shown on the Android redirection page. |
metaDescription | String | Description shown on the Android redirection page. |
Error Response
If the request is invalid, unauthorized, or required parameters are missing, the API returns an error status code (such as 400, 401, or 404) along with a message describing the issue.
{
"statusCode": 400,
"message": "Application id is required!"
}
| Field | Type | Description |
|---|---|---|
statusCode | Number | HTTP status code representing the error (e.g., 400 for a bad request). |
message | String | A human-readable message explaining the reason for the error. |
Rate Limits
This API is rate-limited. For more details, visit the Rate Limits & Error Handling section.