✏️ Update Dynamic Link via REST API
Use ChottuLink's REST API to update existing dynamic links in your account. This endpoint allows you to modify any field of an existing link, making it perfect for link management, campaign updates, or content modifications. Only the fields you include in the request will be updated.
Endpoint
PATCH https://api2.chottulink.com/chotuCore/pa/v1/update-link/{linkId}
Authentication
Include your API key in the request header:
API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Replace c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your actual REST API integration key from
the ChottuLink Dashboard.
Path Parameters
Path Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| linkId | string | Yes | The unique identifier of the link to update | aae848d6-f481-41db-8e5f-b511b5a75669 |
Request Parameters
- All parameters in the request body are optional
- Only fields included in the request will be updated
- Fields not included will remain unchanged
- Make sure not to send unwanted fields
- The link must belong to your organization
Link Configuration
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| destination_url | string | No | The destination URL that the link redirects to | https://yourapp.com/updated-content |
| link_name | string | No | The name assigned to the link for identification | Updated Summer Sale |
Link Behaviors
| Parameter | Type | Required | Description | Values |
|---|---|---|---|---|
| ios_behavior | integer | No | Controls how the link behaves on iOS devices | 1: Open in Browser2: Open in App |
| android_behavior | integer | No | Controls how the link behaves on Android devices | 1: Open in Browser2: Open in App |
UTM Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| utm_source | string | No | Identifies the source of your traffic | email |
| utm_medium | string | No | Identifies the medium of your traffic | newsletter |
| utm_campaign | string | No | Identifies the campaign name | summer2025 |
| utm_term | string | No | Identifies paid keywords | best summer sale |
| utm_content | string | No | Used to differentiate similar content | banner_email |
Social Sharing Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| social_title | string | No | Title that appears when the link is shared on social media | Updated Summer Sale |
| social_description | string | No | Description that appears when the link is shared on social media | Check out our updated amazing deals! |
| social_image_url | string | No | Image URL that appears when the link is shared on social media | https://yourapp.com/images/updated-sale.jpg |
Example Request
Basic Update (Single Field)
curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"link_name": "Updated Link Name"
}'
Complete Update (All Fields)
curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"destination_url": "https://yourapp.com/updated-content",
"link_name": "Updated Summer Sale",
"ios_behavior": 1,
"android_behavior": 2,
"utm_source": "api_update",
"utm_medium": "internal",
"utm_campaign": "updated_campaign",
"utm_term": "updated_term",
"utm_content": "updated_content",
"social_title": "Updated Link via API",
"social_description": "Testing the link update endpoint.",
"social_image_url": "https://yourapp.com/images/updated-image.jpg"
}'
Partial Update (Selected Fields)
curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"destination_url": "https://yourapp.com/new-destination",
"social_title": "New Social Title",
"utm_campaign": "updated_campaign_2025"
}'
Response
Success Response
Status Code: 200 OK
{
"message": "Link updated successfully",
"status": "success"
}
Response Fields
Success Response Fields
| Field | Type | Description | Example |
|---|---|---|---|
| status | string | Response status indicating success | "success" |
| message | string | Human-readable success message | "Link updated successfully" |
Error Responses
Invalid Link ID
Status Code: 400 Bad Request
{
"code": 101,
"errorMessage": "There was one or more validation error(s)",
"error": {
"errorMessage": "Invalid linkId! LinkId is not valid for the organization!",
"fieldName": "INVALID_VALUE"
}
}
Unauthorized Access
Status Code: 401 Unauthorized
{
"code": 130,
"errorMessage": "Authorization Failed!",
"error": {
"errorMessage": "Invalid Api Key",
"fieldName": "UNAUTHORIZED_ACCESS"
}
}
Link Not Found
Status Code: 404 Not Found
{
"code": 103,
"errorMessage": "The requested entity could not be found",
"error": {
"errorMessage": "Link not found or does not belong to your organization",
"fieldName": "LINK_NOT_FOUND"
}
}
Usage Examples
- JavaScript
- Python
- PHP
- Node.js
- cURL
const axios = require('axios');
async function updateLink(linkId, updateData) {
try {
const response = await axios.patch(
`https://api2.chottulink.com/chotuCore/pa/v1/update-link/${linkId}`,
updateData,
{
headers: {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
console.error('Error updating link:', error.response?.data || error.message);
throw error;
}
}
// Usage examples
// Update only the link name
await updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', {
link_name: 'Updated Link Name'
});
// Update multiple fields
await updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', {
destination_url: 'https://yourapp.com/new-content',
link_name: 'Updated Campaign',
utm_campaign: 'updated_campaign_2025',
social_title: 'New Social Title'
});
import requests
def update_link(link_id, update_data):
url = f"https://api2.chottulink.com/chotuCore/pa/v1/update-link/{link_id}"
headers = {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
try:
response = requests.patch(url, headers=headers, json=update_data)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error updating link: {e}")
raise
# Usage examples
# Update only the link name
update_link('aae848d6-f481-41db-8e5f-b511b5a75669', {
'link_name': 'Updated Link Name'
})
# Update multiple fields
update_link('aae848d6-f481-41db-8e5f-b511b5a75669', {
'destination_url': 'https://yourapp.com/new-content',
'link_name': 'Updated Campaign',
'utm_campaign': 'updated_campaign_2025',
'social_title': 'New Social Title'
})
<?php
function updateLink($linkId, $updateData) {
$url = "https://api2.chottulink.com/chotuCore/pa/v1/update-link/{$linkId}";
$headers = [
'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($updateData));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
return json_decode($response, true);
} else {
throw new Exception("Error updating link: HTTP {$httpCode}");
}
}
// Usage examples
// Update only the link name
updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', [
'link_name' => 'Updated Link Name'
]);
// Update multiple fields
updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', [
'destination_url' => 'https://yourapp.com/new-content',
'link_name' => 'Updated Campaign',
'utm_campaign' => 'updated_campaign_2025',
'social_title' => 'New Social Title'
]);
?>
const axios = require('axios');
async function updateLink(linkId, updateData) {
try {
const response = await axios.patch(
`https://api2.chottulink.com/chotuCore/pa/v1/update-link/${linkId}`,
updateData,
{
headers: {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
console.error('Error updating link:', error.response?.data || error.message);
throw error;
}
}
// Usage
updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', {
link_name: 'Updated Link Name',
destination_url: 'https://yourapp.com/new-content'
}).then(data => {
console.log('Link updated:', data);
});
# Update single field
curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"link_name": "Updated Link Name"
}'
# Update multiple fields
curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"destination_url": "https://yourapp.com/new-content",
"link_name": "Updated Campaign",
"utm_campaign": "updated_campaign_2025",
"social_title": "New Social Title"
}'
Best Practices
- Selective Updates: Only include fields you want to update in the request body
- Field Validation: Ensure field values are valid before sending the request
- Error Handling: Implement proper error handling for all response codes
- Link Ownership: Verify the link belongs to your organization before updating
- Testing: Test updates in a development environment first
Update Best Practices
- Minimal Updates: Only send the fields you need to change
- Field Validation: Validate field values before sending requests
- Error Recovery: Implement retry logic for network failures
- Logging: Log update operations for audit purposes
- Testing: Test updates with different field combinations
Error Handling Best Practices
- Check HTTP Status Codes: Always verify response status
- Handle Validation Errors: Provide meaningful error messages for validation failures
- Handle Authorization Errors: Ensure API key is valid and has proper permissions
- Handle Not Found Errors: Verify link ID exists and belongs to your organization
- Log Errors: Log API errors for debugging purposes
Use Cases
Campaign Updates
Update UTM parameters and social sharing information for ongoing campaigns:
await updateLink(linkId, {
utm_campaign: 'summer_sale_2025_v2',
social_title: 'Summer Sale - Extended!',
social_description: 'Get 50% off - Extended for one more week!'
});
Content Updates
Update destination URLs when content moves or changes:
await updateLink(linkId, {
destination_url: 'https://yourapp.com/new-product-page',
link_name: 'New Product Launch'
});
A/B Testing
Update social sharing parameters for A/B testing:
await updateLink(linkId, {
social_title: 'Version B - Amazing Product!',
social_image_url: 'https://yourapp.com/images/version-b.jpg'
});
Rate Limits
The API is subject to rate limiting. Please contact support for specific rate limit information.