Updating a link
Branded short links can be updated via a POST
method to https://api.rebrandly.com/v1/links/{id}
, where {id}
is the unique identifier (id) of the branded short link, which accepts a JSON object describing the Link.
If you don't know the link's id in advance, you can fetch it first with another API call, see Getting link details.
PATH Parameters
Path parameter | Description |
---|---|
id | Unique identifier of the branded short link you want to update |
Link Parameters
The table below shows the parameters you should specify when updating a link.
If you do not want to modify some parameters, you can simply leave them unchanged, i.e. pass their values as you originally received them.
Link property | Type | Constraints | Description |
---|---|---|---|
destination | string | required UTF8 Valid URL Max 2048 chars | New destination URL you want to assign to a branded short link |
title | string | required UTF8 Min 2 chars Max 300 chars | New title you want to assign to a branded short link |
favourite | boolean | required | Whether a link should be marked as favourite (loved) or not |
description | string | optional | Available only if your plan includes link notes A description/note you associate to the branded short link |
Check for compatibility first
Double check whether your API key or OAuth token is enabled to use the Link Notes feature before sending a
description
field along with your Link object.
For every account, you can check for features and limits with a preliminary API call.
$ curl 'https://api.rebrandly.com/v1/links/FFfa4cc5b6ee45d6g7897b06ac2d16af' \
-X POST \
-H 'apikey: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d \
'{
"id": "fffa4cc5b6ee45d6g7897b06ac2d16af",
"title": "What is Rebrandly?",
"destination": "https://www.youtube.com/watch?v=3VmtibKpmXI",
"shortUrl": "rebrand.ly/video"
}'
HTTP/1.1 200 OK
{
"id": "fffa4cc5b6ee45d6g7897b06ac2d16af",
"title": "What is Rebrandly?",
"slashtag": "video",
"destination": "https://www.youtube.com/watch?v=3VmtibKpmXI",
"createdAt": "2016-07-13T10:54:12.000Z",
"updatedAt": "2016-07-15T10:05:22.000Z",
"shortUrl": "rebrand.ly/video",
"domain": {
"id": "8f104cc5b6ee4a4ba7897b06ac2ddcfb",
"ref": "/domains/8f104cc5b6ee4a4ba7897b06ac2ddcfb",
"fullName": "rebrand.ly"
}
}
Handling errors
HTTP Status | Error type | Description |
---|---|---|
403 | 403 - Already exists | Given pair of slashtag and domain forms a branded short link which already exists. Either change the domain or the slashtag |
403 | 403 - Invalid format | Invalid Link object. Double check value for property field. Details about validation failure in message field |
404 | 404 - Not found with property value "id" | Given id does not correspond to any existing link |
404 | 404 - Not found with property value "domain.id" | Given domain.id does not correspond to any existing domain |
Updated 7 months ago