How to get track URIs from the Spotify API - swift

I am currently writing a program which utilizes the Spotify API
I have a program which is capable of playing a track if I have the track URI. My problem is that I am having trouble figuring out how to get the track URI by calling the Spotify API. I was trying to use the SPTRequest class as this was what was in a video which was linked from the Spotify API page, but this is a deprecated class and I am having a lot of trouble figuring out how to navigate these classes. What would I do to get a Spotify track URI if for example I was searching by song name?

You're looking for the Search endpoint!
It will return a track object, which contains the track uri.

Related

Working with the SoundClound API without application registration

At the moment (and for a long time now, as far as I know) there is no way to register an app on SoundCloud. I need to use their API to access public tracks. JavaScript is used. But I always get a 401/403 error response from the server.
As far as I understand, now it is possible to work only after authentication. But for that you need to register the application.
Tell me, is it possible to access API without application registration? I looked through the threads I found, but didn't see a clear answer. SoundCloud support didn't help at all either.

How can I determine if a Soundcloud track is a preview (Soundcloud GO) based on its URL?

My app retrieves tracks from Soundcloud and plays them.
But since a few weeks, it seems that Soundcloud has changed the way it works; and now I often get "preview" tracks; so I can only listen to 30s.
I would like to invalidate those tracks in my app.
Is there a way to do this ?
It seems there is nothing in the URL that permits to recognize those tracks. Maybe I have to do an API call it.
I'm searching for the most basic solution possible.
Thanks !

Playlist not refreshed after adding a track via API

I'm trying to integrate Deezer with Slack. A user would be able to type !play Blackmill - Let It Be in Slack and via a webhook to Deezer API a track would be added to our room's playlist.
To add a track I post to http://api.deezer.com/playlist/123456789/tracks?songs=22945401, it returns true, and the track is actually added. But in the browser where the playlist is currently playing I don't get the new track until a page refresh, so the playlist just stops after the last track that was already there.
I know there's collaborative playlists which somehow work in a similar fashion, so I'm hoping it's possible to implement what I described.
Is there a way I can tell Deezer to refresh the playlist? Or maybe there's a better approach altogether?

Accessing User 'Most Listened To' using Spotify / Echo Nest / Facebook API

I want to know if I can access a user's play history (more specifically what songs they listen to the most) for an app. The app I am building can perform the same goal with iTunes using their built-in play counter. I know Spotify uses a similar counter, but I assume for privacy concerns they don't want to deal with privacy concerns from concerned users. However, I saw a few instances where it was suggested that this task could be accomplished using Facebook's API, or Echo Nest's API. Please let me know if anyone has some constructive suggestions toward finding a way to legally obtain a particular users 'most listened to songs', or something to that effect.
SB
There's some documentation about Open Graph Music on the Facebook Developer homepage:
https://developers.facebook.com/docs/opengraph/music/
Baseline is that you only can request a User's play history if he gave you app the explicit right to read his data.
The relevant permissions would be
user_actions.music https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-user_actions_music
user_actions:{app_namespace} https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-user_actions__app_namespace_
Then, you should be able to request
GET /me/music.listens
according to https://developers.facebook.com/docs/reference/opengraph/action-type/music.listens/ You'll need to perform the aggregation of the most played songs/artists yourself, because there's no endpoint for that.

Searching spotify user's music library for particular genre

I am developing third party app on spotify platform. In that, user have to select spotify user's music library playlist (top 100 songs by Spotify user). So, I am trying to search spotify library for particular genre.
I am using SPSearch with Query genre:pop. But for some generics like "rock" it return nil.
I am using latest build of cocoalibspotify. Please can somebody tell how to get Spotify user track list or playlist for particular genre?
The full advanced search documentation can be found here.
Note that this will search the entire Spotify catalog, not just the user's own library. There's currently no built-in way to only search the user's library at this time.