Creating a query parameter

You can create your custom Query Paramters which you'll be able to use to compose any Branded Link's destination URL in the workspace.

Parameters in a workspace can be created via:

  • POST HTTP request to /templates/{TEMPLATE_ID}/params

Query parameter properties

The table below shows the property that can be passed in the request body.

Property

Type

Constraints

Description

key

String

  • required
  • No spaces accepted.
  • Allowed characters: a-z,0-9,.,_,-,~
  • Min 1 chars
  • Max 32 chars

This is the key of the querystring pair key=value.

label

String

  • required
  • Min 1 char
  • Max 64 chars

A human-friendly label for the query string parameter.

format

String

  • required
  • Set of accepted values: string | preset

Specify the type of query parameter. Type string is a simple parameter that can assume any string value. When selecting preset you can specify a set of options from which a user can select a value to assign to the key

options

Array of Objects

  • optional
  • must be specified only if format propery is set to preset

A list of values from which a user can choose a value for the parameter. It's useful to help teammates to compose a query string or to spped up the process in the UTM-builder on Rebrandly Dashboard.
Option format is:\

{    
   "value": "a_value_for_the_param",    
   "label": "A human-friendy label"     
}

placeholder

String

  • optional

The placeholder to show in the parameter input in UTM-builder on Rebrandly Dashboard

default

String

  • optional

Can store a default value for the query parameter key

An example of request is

$ curl 'https://templating.rebrandly.com/v1/url/querystring/templates/{TEMPLATE_ID}/params' \
-X POST \
-H 'apikey: YOUR_API_KEY' \
-H 'workspace: YOUR_WORKSPACE_ID' \
-H 'Content-Type: application/json' \
-d \
'{
	"format": "string",
	"key": "mycustomparam",
	"label": "My Custom Param",
	"placeholder": "Insert a value for this custom param"
}'

A 200 response for this request is

{
	"id": "feede945fdf147cb...",
	"format": "string",
	"options": [],
	"label": "My Custom Param",
	"placeholder": "Insert a value for this custom param"",
	"key": "mycustomparam"
}