Does Bitly v3 shorten API work?

4.3k views Asked by At

Does anybody have a working example of Bitly's V3 API working?

The Oauth seems to work but shorten always returns:

{data=[], status_code=500, status_txt=MISSING_ARG_APIKEY}

Even if I supply the apiKey (which I shouldn't have to if I'm using the access_token) I still get the error. I have tried both the SSL and non SSL endpoint. The V2 api works fine for me though.

2

There are 2 answers

0
Pablo Gonzalez Portela On

If you were trying the thing using curl via command line and were not quoting the url, then the first ampersand meant to be an argument separator actually executed what you had typed so far in the background, thus breaking the whole thing.

Simple answer for that, quote the whole url string and it should work.

1
prongs On

Yes. it works.

Example:

http://api.bit.ly/v3/shorten?format=txt&login=$username$&apiKey=$key$&longUrl=$longurl$

you can get username and api key from here. For username, there's a section named Public Timeline where there will be links like https://bitly.com/u/o_19rtfe2ph0 and https://bitly.com/u/o_19rtfe2ph0.rss. Here o_19rtfe2ph0 is the username to be used.

Hope it helps. Here's the full documentation.