How to convert Long url to tiny url without processor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2022 06:25 AM
I have a requirement that is convert long URL to tiny URL without using processor because in customers instance we cannot create a processor. I tried with so many articles but couldn't get proper solution. i tried with this code it is not working. is there any solution for this?.
- Labels:
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2024 12:25 PM - edited ‎07-31-2024 12:27 PM
Check out the GlideTinyUrl class. Do a code search in your instance and you can find some examples.
For example:
new GlideTinyURL().createTinyURL(url);
or if you always want it to be a tiny url
new GlideTinyURL().createTinyURLWithCustomLength(url, 10);
Pretty sure it is a global only API so you might need to wrap it in a global script include, but thats alot better than making ajax request from the server to the server haha. The default one will use the system property
glide.tiny_url_min_length
to determine when to generate a TinyURL and when to just passthrough the URL.