You can attach a Script object to a Link object.
When someone clicks on the link, during the redirection process the script will be executed on his/her browser.
Check compatibility first
Double check whether your API key or OAuth token is enabled to use the Scripts feature.
For every account, you can check for features and limits with a preliminary API call.
In order to attach a Script to a Link, you must first create both the resources and get their unique identifiers. Once you have them, you can perform a
POST API call (without body) to the association endpoint, which is composed as follow:
sid is the Link resource's
id property and
sid is the Script resource's
|lid||Unique identifier of the branded short link you want the script to be attached to|
|sid||Unique identifier of the script you want to attach to the link|
Attaching a Scripts to a Link
$ curl 'https://api.rebrandly.com/v1/links/FFfa4cc5b6ee45d6g7897b06ac2d16af/scripts/3aehje9d536s46d59ba5bcf49b582ear' \ -X POST \ -H 'apikey: YOUR_API_KEY' \ -H 'Content-Type: application/json' HTTP/1.1 200 OK
Updated over 3 years ago