bityl url shortner to shorten url | Community
Skip to main content
Level 3
January 12, 2024
Solved

bityl url shortner to shorten url

  • January 12, 2024
  • 2 replies
  • 1612 views

Hi All,

 

i need code to do url shortning to send one of the sms campaign

 

Please help me how can i shorten that url

bityl url shortner to shorten url

please provide code/url ---how can we achieve that

 

@Manoj_Kumar_ 

@Craig_Thonis 

@ParthaSarathy

@AkshayAnand 

@Craig_Thonis 

@Manoj_Kumar_ 

@Amine_Abedour 

@Marcel_Szimonisz

@DavidKangni 

@322232 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manoj_Kumar

Hello @jefrii 

 

You can use this code to call bitly API

var req = new HttpClientRequest("https://api-ssl.bitly.com/v4/shorten") req.header["Authorization"] = "Bearer TOKEN_HERE" ; req.header["Content-Type"] = "application/json"; req.method = "POST"; req.body = '{ "group_guid": "GROUP_UUID_HERE","domain": "bit.ly","long_url": "LONG_URL_HERE"}' ; try { req.execute() var response = req.response; var res=JSON.parse(response.body); return res.link; } catch(e) { return "unable to exceute api"; } req.disconnect()

 

this is just a sample code to get you started

2 replies

AkshayAnand
Community Advisor
Community Advisor
January 13, 2024

Hi @jefrii 

 

I too had a similar use case where I used rebrandly as our 3rd party. 

As I guess bitly is also an open source API, so you can create your account and keys to play around with the API projects. Once you are familiar with the body parameters which you need to send to bitly through an API call to get the shortened URL in response. You can create the same call in Adobe through JavaScript in a workflow and make the call to bitly to get the shortened URL in response after whitelisting the bitly URL in console.

 

Thanks,

Akshay

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
January 14, 2024

Hello @jefrii 

 

You can use this code to call bitly API

var req = new HttpClientRequest("https://api-ssl.bitly.com/v4/shorten") req.header["Authorization"] = "Bearer TOKEN_HERE" ; req.header["Content-Type"] = "application/json"; req.method = "POST"; req.body = '{ "group_guid": "GROUP_UUID_HERE","domain": "bit.ly","long_url": "LONG_URL_HERE"}' ; try { req.execute() var response = req.response; var res=JSON.parse(response.body); return res.link; } catch(e) { return "unable to exceute api"; } req.disconnect()

 

this is just a sample code to get you started

Manoj  | https://themartech.pro