sebonlien / bitly-api

Automatically exported from code.google.com/p/bitly-api
0 stars 0 forks source link

not able to short follwing URL #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem (provide an exact http api call where
appropriate)?

i am trying to short follwing url but it will not short as expected it will
just cut after some string. but it will work fine in bit.ly website

http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=2801+Ocean+P
ark+Blvd&city=Santa+Monica&state=CA&csz=Santa+Monica,+CA+90
405-5200&slt=34.018220&sln=-118.457158&name=&zip=90405-5200
&country=us&&BFKey=&BFCat=&BFClient=&mag=6&desc=&cs=9&ne
wmag=8&poititle=&poi=&ds=n 

What is the expected output? What do you see instead?
it will short my URL

What version of the product are you using? On what operating system?
Version 3 and windows xp

Please provide any additional information below.
http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=2801+Ocean+P
ark+Blvd&city=Santa+Monica&state=CA&csz=Santa+Monica,+CA+90
405-5200&slt=34.018220&sln=-118.457158&name=&zip=90405-5200
&country=us&&BFKey=&BFCat=&BFClient=&mag=6&desc=&cs=9&ne
wmag=8&poititle=&poi=&ds=n 

Original issue reported on code.google.com by shaan.gi...@gmail.com on 13 Apr 2010 at 9:19

GoogleCodeExporter commented 8 years ago
Can you describe what api call you are making, and how you are making that 
call? (an example would be best)

Are you encoding the maps.yahoo.com url properly to escape the characters like 
'?' and '&' ?

Original comment by jehiah on 13 Apr 2010 at 1:40

GoogleCodeExporter commented 8 years ago
I am trying to do following thing

http://api.bit.ly/v3/shorten?&login=ogoing&apiKey=R_a3556877b23a182468abf8690cb0
8a4b&uri=http://maps.yahoo.com/py/maps.py?pyt=tmap&addr=2801+ocean+park+blvd&cit
y=santa+monica&state=ca&csz=santa+monica,+ca+90%20405-5200&slt=34.018220&sln&for
mat=xml

it will give me 

<response>
<status_code>200</status_code>
<status_txt>OK</status_txt>
−
<data>
<url>http://bit.ly/92j9lg</url>
<hash>92j9lg</hash>
<global_hash>cUg0xK</global_hash>
<long_url>http://maps.yahoo.com/py/maps.py?pyt=tmap</long_url>
<new_hash>0</new_hash>
</data>
</response>

why long url is http://maps.yahoo.com/py/maps.py?pyt=tmap ?

its successfully work on bit.ly then why its not working on api?

is this because of long number of characters are more ? then why don't we 
change the
perimeter string to long string? (just thought)  

Thanks

Shankar Gidwani

Original comment by shaan.gi...@gmail.com on 14 Apr 2010 at 5:15

GoogleCodeExporter commented 8 years ago
As mentioned in my previous comment, and in the bit.ly api documentation you 
need to encode the url you 
would like to shorten when constructing your api request.

This means that to shorten the example you listed, you should be inserting the 
encoded url in your api request

> 
http%3A%2F%2Fmaps.yahoo.com%2Fpy%2Fmaps.py%3Fpyt%3Dtmap%26addr%3D2801%2Bocean%2B
park%2Bblvd%2
6city%3Dsanta%2Bmonica%26state%3Dca%26csz%3Dsanta%2Bmonica%2C%2Bca%2B90%2520405-
5200%26slt%3D34.018220%26sln

not

> http://maps.yahoo.com/py/maps.py?
pyt=tmap&addr=2801+ocean+park+blvd&city=santa+monica&state=ca&csz=santa+monica,+
ca+90%20405-
5200&slt=34.018220&sln

For more information about URI encoding, see the notes listed on the api 
documentation
http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/v3/shorten

Original comment by jehiah on 14 Apr 2010 at 5:29