Creating a new script

🚧

Check for 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.

Tags can be created via a POST method to http://api.rebrandly.com/v1/scripts, which accepts a JSON object describing a Script .

Script Parameters

The table below shows the parameters you should specify when creating a Script:

Link property

Type

Constraints

Description

name

string

required
UTF8
Min 2 chars

Unique name of the script

value

string

optional
Valid javascript code

Javascript snippet including opening and closing

Creating a new Tag

$ curl http://api.rebrandly.com/scripts \
-X POST \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN_HERE' \
-H 'Content-Type: application/json' -d '
{
  "name": "Alert",
  "value": "<script>alert('test');</script>"
}'

HTTP/1.1 200 OK
JSON Response (just created Script)
{
  "id": "3aehje9d536s46d59ba5bcf49b582ear",
  "name": "Alert",
  "value": "<script>alert('test');</script>"
}

Did this page help you?