URLShortener.shortenURLs (Method)

Given a string containing one or more URLs, will create shortened URLs with the specified services, replace the long URLs in the string with the shortened URLs and return the detailed structure.

Returns:

URLShortener_ShortenURLs_Struct (struct)

Each row of the returned query results has the following fields:

Field Name Type Description
ShortenedURLsDetailArray URLShortener_ShortenedURLInfo_Struct_Array An array of structure containing information of the long and shortened versions of the URLs.
URLShortenedContent String The content with long URLs in the string replaced with the shortened URLs.

Arguments:

Name Type Required Description
string String Required The string containing un-shortened URLs.
id URLShorteningServiceID Required The ID of the URL shortening service to use.
appendID NonNegativeInteger Required The unique ID to append to the long url to make the shortened url unique. Usually it is the social media post ID.

Context:

License Requirements (none)
Permission Requirements ContributorOrServerCode
Deny Context (none)
Require Context (none)
Author Lock (not required)
Transaction Logging If transaction logging is enabled at the site level, calls to this method will be logged
Customization Customization is not supported for this method.

Error Codes:

Code Error Message
84502 Could not find the component for the url shortening service.
84503 Could not create the object of the component for the url shortening service.
84504 Component is not defined for the url shortening service.
84505 Commonspot has not been granted access or the user has revoked the access to the url shortening service to be used to shorten the URLs.
84506 Some error occurred while trying to shorten the passed URL.
84507 $1
84508 Some error occurred while trying to retrieve the access token.
84510 Access token for the service is not defined.

Notes:

None