There are three possible values supported: Inside the callback function, we make a GET request to the /me endpoint which returns the object of currently logged-in user.In the above example, the access parameter indicates which level of playback accessibility for a track is available to the requesting user. 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. Then we attach a click event handler to the #login button.We can do it in our basic HTML document, which we created earlier, or in an external. Initialize the Clientīy “initializing the client”, we mean to make the client ready to exchange data between itself and SoundCloud API. We can leave the website and callback fields for now. There we will find our app’s Client ID, which will be used to authorize our requests. Give it a name and accept SoundCloud’s Developer Policies by checking the checkbox.Ĭlick on the big Register button, to complete the app registration.Īfter we have successfully registered, we will be redirected to the settings page of our newly created app. You can use the same account which you use for personal purposes.Ĭlick on the Register a new application button. Note: You do not need to make a separate account for this purpose.
![soundcloud download not working api soundcloud download not working api](https://i.ytimg.com/vi/cQu1ihMJiTs/maxresdefault.jpg)
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.
![soundcloud download not working api soundcloud download not working api](https://cdn.slidesharecdn.com/ss_thumbnails/oblablabladoresponsive-140317232819-phpapp02-thumbnail.jpg)
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.
![soundcloud download not working api soundcloud download not working api](https://i.pinimg.com/originals/8b/8e/5c/8b8e5cd9c48c1cf5df8f008d17c27d5c.jpg)
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.
![soundcloud download not working api soundcloud download not working api](https://i.ytimg.com/vi/uEDao0qT9JU/0.jpg)
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.