Update Link
This request updates a link, targeted by secure ID.
patch | /shortener/links/{link_sid} |
put | /shortener/links/{link_sid} |
Sample
A sample PATCH request to update the link object, targeted by secure ID, with the values in the request body:
curl -X PATCH \
'https://api.carrierx.com/core/v2/shortener/links/a533f53a-7e6f-4822-be3c-3767924ee2a9' \
-H 'Content-Type: application/json' \
--data-binary '{"mode":"redirect_permanent"}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'
Response
200
status code with a serialized copy of the updated link object:
{
"date_accessed": null,
"date_created": "2024-01-18T19:26:02.000Z",
"destination_url": "http://destinationurl.com",
"domain_sid": "330a8a83-d4bb-4f39-ae54-c59c8d87cd44",
"hits": 0,
"link_sid": "a533f53a-7e6f-4822-be3c-3767924ee2a9",
"maximum_ttl": -1,
"mode": "redirect_permanent",
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"short_name": "eOtEtO",
"url": "http://newdomain.com/eOtEtO"
}
A Link object can be updated using either a PATCH
or PUT
request.
-
A
PATCH
request can be used to update one or more attribute values. When using aPATCH
request, only the attributes specified in the request payload will be updated, all other attributes and values will remain the same. The link secure ID is passed in the query URL, and the values to be modified are passed in the request body. -
A
PUT
request can be used to update an entire Link object. The link secure ID is passed in the query URL, and the entire Link object is passed in the request body.
Note, while all the fields must be present in a PUT
request, not all the attribute values may be modified after the initial creation, because when created, some of them become read-only.
Required Scopes
To update a Link object, the partner must have one of the following scopes enabled:
shortener.manage
shortener.update
To set the mode
field value to proxy_pass
, the partner must additionally have the shortener.allow_link_mode_proxypass
scope enabled.
Path Arguments
Parameter | Data Type | Description |
---|---|---|
link_sid required | string | The link secure ID. |
Body Arguments
JSON representation of the fields and values to be updated.
Fields that can be modified are:
destination_url
maximum_ttl
mode
short_name
Refer to this table to view all fields that appear in the link object.