It has more than 200 million tracks with the most popular ones being the latest hits, or by genre, by emerging artists. Inside the callback function, we make a GET request to the /me endpoint which returns the object of currently logged-in user.This application is a free, online music distribution service. Then the callback function of SC.connect() gets executed. After the user has logged-in, pop-up window closes.
Which when clicked, will execute SC.connect(callback) which opens a pop-up window prompting user to login.
Make sure you are logged in to your SoundCloud account. Here any apps we have already created will be listed. It will be explained in the next section. Note: We can skip this step, if we are not going to use the user-login feature in our website. By registering an app, SoundCloud servers will be able to verify our request, so no one else can make a request on our behalf. If you don’t have one already, go ahead and create one. To register a SoundCloud app, all you need is a SoundCloud account. Try refreshing and make sure the path to the SDK file ( sdk.js) is correct. If an undefined error shows up then it is not loading correctly. SC is a Javascript Object created by the SDK which we just included.
In the Console, type SC and press enter.Open up Developer Console in the browser ( Ctrl + Shift + J, in Chrome).Open up the page in a browser (Chrome recommended).To test if the SDK gets loaded in your webpage correctly: You can also download the SDK and reference to it like: Notice that we have included the SDK in our page directly from SoundCloud’s servers. We will also include the SDK here, so we can make use of its functionality. We will create a basic HTML page which will serve as our homepage. Using the SoundCloud API Setup a Basic HTML Document This version will require callback functions for asynchronous requests. So, for simplicity’s sake, and because it is more stable, we will use the old version in the examples throughout this tutorial. One problem I noticed, is that with the version of SDK used by the documentation, there seems to be an issue with user-login functionality, as the pop-up window doesn’t close automatically. The latest version returns a Promise, while the other requires a callback function as a parameter.
The major difference between them is how they return data when an asynchronous request is made to the API. As mentioned earlier, there are two different versions of the SDK available. To start querying the SoundCloud API using JavaScript, we need to download the JavaScript SDK provided by SoundCloud.
SOUNDCLOUD DOWNLOAD NOT WORKING API CODE
jQuery is used in our code examples, so knowing the basics won’t hurt. A little knowledge of asynchronous JavaScript, promises and callbacks will also help. If you want to learn more about APIs, I recommend this short course: An Introduction to APIs. Knowing the concepts and workings of HTTP and APIs will be helpful.