Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Please see below the most popular frequently asked questions.
Loading article...
Loading faqs...
Please see below the current ongoing issues which are under investigation.
Loading issue...
Loading ongoing issues...
Plan
Free/Premium
Country
France
My Question or Issue
Hi everyone, I'm here to ask a question, I would like to get an artist genre on android studio with the spotify sdk but when I went on the documentation no field contained the genre of the artist. I know that with spotify web api with a get request we can get in the json file the genre. So I tried to made a get request on my android app with the token of the user auth on the project but it didn't work. So if someone knows how can I get it, it would be nice. Have a nice day.
Solved! Go to Solution.
Sorry I had to send it quickly yesterday :
public void artistRequest(String token){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.addHeader("Authorization","Basic : "+encodedInput)
.url("https://api.spotify.com/v1/artists/41X1TR6hrK8Q2ZCpp2EqCz")
.addHeader("Authorization","Bearer "+token)
.addHeader("Accept","application/json")
.addHeader("Content-Type","application/json")
.build();
Response response = null;
try {
response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
Log.i("DEBUG GET CODE : ", String.valueOf(response.code()));
Log.i("DEBUG GET CODE : ", response.message());
}
I call this method async from the main ui thread, with the access token that spotify api sent me thank to the authorization library for android studio. And maybe it doesn't work because token from authorization library is not compatible with request from spotify web api ? Don't know
but it didn't work
You have to be more specific than that. The access token returned by the iOS SDK can be used with the web API, so I assume the same applies to the Android SDK. Does the access token work with any web API Endpoints?
Show me the code where you make the request to the Spotify web API.
here you go
Don't ever post a screenshot of code. Always post it as text so that someone else can copy and paste it and run it themselves.
Sorry I had to send it quickly yesterday :
public void artistRequest(String token){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.addHeader("Authorization","Basic : "+encodedInput)
.url("https://api.spotify.com/v1/artists/41X1TR6hrK8Q2ZCpp2EqCz")
.addHeader("Authorization","Bearer "+token)
.addHeader("Accept","application/json")
.addHeader("Content-Type","application/json")
.build();
Response response = null;
try {
response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
Log.i("DEBUG GET CODE : ", String.valueOf(response.code()));
Log.i("DEBUG GET CODE : ", response.message());
}
I call this method async from the main ui thread, with the access token that spotify api sent me thank to the authorization library for android studio. And maybe it doesn't work because token from authorization library is not compatible with request from spotify web api ? Don't know
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…