0

The SDK demo works fine (it doesn't need special CORS stuff since it is on the same domain)

When I try to send the request from localhost:8080 this happens

this

So I'm trying to request api.soundcloud.com/tracks - first my browser sends an OPTIONS req to api.soundcloud.com asking if it's okay to call cross-origin. api.soundcloud.com does not return the headers my browser is looking for so my browser throws an error and can't make the request.

Am I the only person trying to use the APIs from another domain or is something going wrong here?

EDIT: Doing debugging in wireshark - when making an API call using the SDK in the browser an OPTIONS request isn't even being sent. WTF

Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63
Contra
  • 1,691
  • 15
  • 14

1 Answers1

0

here's a working example where request is coming from jsbin.com:

var request = new XMLHttpRequest();

request.onreadystatechange = function () {
  if (request.readyState === 4 && request.status === 200) {
    console.log(request.responseText);
  }
};
request.open('GET', 'http://api.soundcloud.com/tracks?client_id=YOUR_CLIENT_ID');
request.send();
Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63