Can't get any response--possibly CORS problem?

205 views
Skip to first unread message

Julie

unread,
May 11, 2012, 12:49:35 PM5/11/12
to bitly API, a...@bitly.com
Not sure what I'm doing wrong, but I can't get to square one on the
simple task of requesting a shortened URL.

When I try to call the API from JavaScript, I just get a 404 error in
FF. Chrome has a somewhat more helpful error in the console:
(I substituted ACCESS for my access token and HOST for my hostname)

XMLHttpRequest cannot load
https://api-ssl.bitly.com/v3/shorten?access_token=ACCESS&longUrl=https%3A%2F%2FHOST%2F%2Fdb%2Fbg63bpbwq%3Fa%3Dq%26qid%3D1.
Origin https://HOST is not allowed by Access-Control-Allow-Origin.

I thought that the API allowed CORS from all domains? That's what the
documentation says (http://dev.bitly.com/cors.html).

If I enter the URL directly on the browser address bar in either
browser, I get the following response: { "data": [ ], "status_code":
500, "status_txt": "UNKNOWN_ERROR" }

Can anyone please help me figure out what's not working?

Thanks very much!
Julie

Matt Gifford

unread,
May 30, 2012, 12:44:59 PM5/30/12
to bitl...@googlegroups.com
Hi Julie. If you're using a local dev environment and accessing through te browser using http://localhost you'll get this error.

Try using http://127.0.0.1 or setting a dummy domain in your hosts file to point to the local environment.
> --
> You are subscribed to the bit.ly API discussion group.
> To post, email to bitl...@googlegroups.com
> For more options, visit http://groups.google.com/group/bitly-api
Reply all
Reply to author
Forward
0 new messages