0
stackoverflowに関する質問がいくつかありますが、私のようなものですが、問題を解決できませんでした。エラーは、タイトルに記載されているとおりです。私はを得るためにSpotify APIを使って作業しています。私は何が起こっているのかとの基本的な誤解があるように感じる。ここで
は、私は私の主な活動で持っているものです。ここで
Gson gson1 = new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
.setLenient()
.create();
Retrofit retrofit1 = new Retrofit.Builder()
.baseUrl(ENDPOINT_ACCOUNTS)
.addConverterFactory(GsonConverterFactory.create(gson1))
.build();
SpotifyAPI spotifyAPI = retrofit1.create(SpotifyAPI.class);
Call<User> call1 = spotifyAPI.getUserData("Authorization: Bearer " + sp.getString("accessCode", "DEFAULT"));
call1.enqueue(new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
...
}
@Override
public void onFailure(Call call, Throwable t) {
...
}
});
は私のインターフェイスです:
String ENDPOINT_V1 = "https://api.spotify.com/";
@GET("/v1/me")
Call<User> getUserData(@Header("Authorization") String authorization);
そして、ここでは私のUserクラスです:
public class User {
String id;
public String toString() {
return(id);
}
}
ONFAILURE()されますトリガされ、タイトルのエラーメッセージを吐き出します。ユーザーのすべてのインスタンスをResponseBodyに置き換えた場合、その呼び出しはステータスコード200で成功します。しかし、応答の内容はまったく必要ではありません。私が提供できる情報があれば教えてください。ありがとうございました。