Bitly is stripping out my url params

1,060 views
Skip to first unread message

Derik Linch

unread,
Jan 25, 2018, 11:29:36 AM1/25/18
to Bitly API
Hi, 

We're using Bitly to transform big ugly urls of job postings into bitly links that we text to users. None of the bitly links come through correct, and they seem to be stripping out all params in the url, anything after the first `&` seems to be completely ripped out and that makes the link invalid. 

I couldn't find anywhere on the Bitly documentation that they remove params, nor find any reference to anyone else having the same issues as us. Is this the intended behavior? Is there a config in the admin that I could use to turn this off? Is this some kind of weird bug?

Peter Herndon

unread,
Jan 25, 2018, 11:37:52 AM1/25/18
to Bitly API
Hi Derik,

We see this error happen when you have not properly URL-encoded your longUrl query parameter. That is, chances are you are calling `https://api-ssl.bitly.com/v3/shorten?access_token=XXXX&longUrl=https://google.com` when you should be calling `https://api-ssl.bitly.com/v3/shorten?access_token=XXXX&longUrl=http%3A%2F%2Fgoogle.com`. One reference is https://en.wikipedia.org/wiki/Percent-encoding, and most programming languages have some facility for URL encoding built in to their standard libraries, e.g. `urlencode` function in `urllib` in Python 2.x.

Regards,

---Peter

Peter Herndon
Security DevOps Engineer
@Bitly
Reply all
Reply to author
Forward
0 new messages