How to get the playlist that the current user is following in spotify? - spotify

I wanted to get the playlist that the user is following in the spotify api but could not seem to find the way. Can you tell me how to do this ? Thank You

At the moment with the Spotify Web API, you can only request all the Playlists that a User is Following and the Playlists created by the Current User with Get a List of Current User's Playlists.
However you can see what the Owner of a Playlist is so you could use Get Current User's Profile to get the profile for the Current User. Then get all the Playlists with Get a List of Current User's Playlists and see which ones have a different Owner than the Current User, this is the only currently supported way of determining which Playlists a User is Following.

Related

Spotify remove a track from a playlist not owned by the user

As you might know, the permission system from Spotify isn't the best. You can just mark a playlist collaborative, and every single spotify user can edit the Playlist without my approval. Therefore, I am writing an application (using Spotify Web Api, node and mysql) that gives the user more control over the collaborative playlists. It should support sub-playlists, votes and a small permission system, which allows just some users to modify the playlist.
In order for that to work, I need a service running all the time in the background. This service should sync my version of the playlist with spotify. Because the user, who owns the playlist, will most likely not be logged in, i have created a special Spotify User for my service. Now, i have to edit the collaborative Playlist using this spotify user.
When i try to delete some Tracks from such a playlist, i get the following answer:
{
"error" :
{
"status" : 403,
"message" : "You cannot remove tracks from a playlist you don't own."
}
}
Do you know if there is a way to delete a Track from a playlist i don't own? And if not, Do you have any idea how to get around this problem?
Do you know if there is a way to delete a Track from a playlist i don't own?
This isn't possible, even if the playlist is collaborative.
And if not, Do you have any idea how to get around this problem?
One way is to create a playlist owned and edited by a user that you control. Server-side you'd keep an access token for that user, and simply refresh it when necessary. Since the refresh token lasts forever, you'd never have to require a user to go through any form of authentication flow.
Hope this helped!

(Instagram API) Get the list of instagram users this user is followed by

I want to get the list of instagram users this user is followed by.(but not for myself, for another user).
I do API call GET
https://api.instagram.com/v1/users/4234233244/followed-by.json?access_token=ACCESS_TOKEN
like this
/v1/users/user_id/followed-by.json?access_token=ACCESS_TOKEN
But I receive following response
{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}
Why? How can I do that? I set up follower_list permission scope(Actually all scopes scope=basic+follower_list+public_content+relationships+likes+comments).
And He's not a private user, I think so ;). And my dev app is in Sandbox mode, and this user was added to to the Sandbox, so I can get his profile information.
I know
Deprecation of /users/USER-ID/follows and /users/USER-ID/followed-by
But what should I do? I try to develop a great instagram client for tablet :)
I dont think you can get other user's follower list/following list anymore. You can only get the list for the logged in user.
Here is documentation: https://www.instagram.com/developer/endpoints/relationships/
https://api.instagram.com/v1/users/self/followed-by?access_token=ACCESS-TOKEN
you can only get list for self, not any id
List of users who your user follow :
https://api.instagram.com/v1/users/self/follows?access_token=ACCESS-TOKEN
List of users who your user is being followed by :
https://api.instagram.com/v1/users/self/followed-by?access_token=ACCESS-TOKEN
List of recent media from your user :
https://api.instagram.com/v1/users/self/media/recent?access_token=ACCESS-TOKEN
List of recent media from other users :
https://api.instagram.com/v1/users/{user-Id}/media/recent?access_token=ACCESS-TOKEN
More information at Instagram Endpoint Reference
in left pane (below Endpints button) you will see a list of media types, each one corresponding to a page that explains all related api Interfaces.

Is there any way to get an artist's user id with the Spotify API?

One of the cool things about Spotify is the ability to view playlists created by both users and artists.
You can get a list of playlists for any user with:
https://api.spotify.com/v1/users/{user_id}/playlists
This will work if you plug in an artist's user id as well.
Example: https://api.spotify.com/v1/users/officialfoofighters/playlists returns playlists created by Foo Fighters (the actual band).
The problem is that I see no way to programmatically get an artist's user id. The actual artist id is different and will not work. I managed to manually get Foo Fighter's user id in a hacky way using the Spotify desktop client, but I would like to find a programmatic solution.
Anyone know of any workarounds?
I'm happy that you're asking for this, because it's a feature that we've been wanting to add to the Web API for a while. So even though the answer to this question is that it isn't possible to find an artist's username using the Web API (and the other way around) right now, I'd urge you to keep up to date on changes in the API through #SpotifyPlatform or our Change Log.

How to grab user track info through spotify api

I recently just got through the beginning tutorial for creating a web app with the spotify api. https://developer.spotify.com/web-api/tutorial/. The tutorial was great for showing how to authenticate a user with oauth and log in a user.
The problem I am having is with the endpoint. I can't seem to figure out how to change the endpoint so that instead of displaying a users profile, I can see a list of a users track, better yet starred or top 10 tracks.
for a 10,000 view perspective of what I want to build is a app that would allow users to easily log in through their spotify account, take their stared or top tracks and push them to a radio that I am building with an raspberry pi.
I am new to working with the spotify api and working with api's in general so whatever advice would be awesome.
At the moment, there is no way to get the "starred"-playlist. (At least it's not documented)
I don't know what you mean with "Top 10 User tracks", since this doesn't exist as far as I know
To get a list of the account's current playlists, change the URL to:
https://api.spotify.com/v1/users/{user_id}/playlists
With this URL, you will get a list of simple-playlist-objects wrapped inside a paging-object. Now you can select one of the playlists (or loop through them) and fetch its track this way
NOTE:
If you also want to fetch private playlists, make sure you use the scope playlist_read_private

Create app-bound playlist on Spotify

Is it possible to create an app-bound playlist?
It's possible to create a playlist for a user, but how will I know which one that is when they move away from my app?
Ideally, I would only need to be able to create/edit 1 playlist.
Edit: Have found this http://developer.spotify.com/technologies/apps/guidelines/integration/#appsthatcreateplaylisturi:s
But if anyone has great ideas, I'm still open!
As you've found out yourself, you can't create a playlist in a user's library that's somehow linked to your application using the Spotify Apps API.
I thought it'd be a good idea to also quote the relevant part of the Integration Guidelines that you've linked to:
If you want to generate and save the user’s personal playlists in the
app, you should not keep playlist information only saved within the
app. Playlist information should instead be handled by utilizing user
playlists, so that the user can access playlists as usual. They
shouldn’t have to go to the app to access a certain playlist that they
have created.
Suggestion:
I think there's several ways to do what you want to do though.
One way could be to let a user create a new playlist using your application and save it to the user's library, and at the same time save the playlist URI to your own back end. As you've noted, playlist URIs are obfuscated (e.g. they look like spotify:user:#:playlist:783BHaT7Xb8K5VyYstxsj3 instead of spotify:user:thelinmichael:playlist:783BHaT7Xb8K5VyYstxsj3, the username is replaced by # for the currently logged in user, and #xxx.. for other users). You could still save the last part of the URI, which I believe is unique for every playlist. Using a hashmap to map that part of the playlist URI to properties you want to keep track of would let you do quick lookups of a user's playlists to see if they are associated to your app. You could iterate though the user's library to gather all obfuscated URIs, and send them to your backend in a single HTTP request. The response from your server could be the index of the library playlists that matched the playlist on your backend, along with the properties you've mapped to it. Again, this was just a suggestion and possibly not the best way forward but I hope it gave you some ideas. :-)

Resources