Delete Link By Prefix
The Delete Link by Prefix endpoint allows you to delete a specific AppLink using its urlPrefix and shortId. It uses the DELETE method and returns a JSON response with AppLink ID and deleted flag.
- Before getting started, ensure your AppLink Configuration is set up.
Endpoint
This is the DELETE URL you’ll use to delete a specific AppLink.
https://api.appsonair.link/api/v1/applinks/delete-by-prefix
Request Headers
See Authorization for the required authentication headers.
Request Payload
The request payload defines the data required to delete a specific 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 delete 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/delete-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/delete-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: headers,
body: JSON.stringify(body)
})
.then(response => {
if (response.status === 200 || response.status === 204) {
return response.json().catch(() => ({}));
} else {
return response.text().then(text => {
throw new Error(`Error ${response.status}: ${text}`);
});
}
})
.then(data => {
console.log("Success:", data);
})
.catch(error => {
console.error("Error:", error.message);
});
import requests
url = "https://api.appsonair.link/api/v1/applinks/delete-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, json=payload)
if response.status_code in [200, 204]:
try:
print("Success:", response.json())
except ValueError:
print("Success: AppLink deleted successfully")
else:
print(f"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 DeleteByPrefix {
public static void main(String[] args) {
try {
String url = "https://api.appsonair.link/api/v1/applinks/delete-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);
// Request body
String jsonInputString = "{\n" +
" \"data\": {\n" +
" \"urlPrefix\": \"example.appsonair.link\",\n" +
" \"shortId\": \"XXXXX\"\n" +
" }\n" +
"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
response.append(line.trim());
}
in.close();
System.out.println("Success: " + response.toString());
} else {
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getErrorStream(), "utf-8"));
StringBuilder errorResponse = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
errorResponse.append(line.trim());
}
in.close();
System.out.println("Error " + responseCode + ": " + errorResponse.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
<?php
$url = "https://api.appsonair.link/api/v1/applinks/delete-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_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200 || $httpCode == 204) {
echo "Success: " . $response;
} else {
echo "Error ($httpCode): " . $response;
}
?>
Response
The API returns either a success response with the ID 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": "XXXXXXXXXX",
"deleted": true
}
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the AppLink. |
deleted | Boolean | Returns a true or false value. |
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.