private static JSONObject createPlaylist(String spotifyId, String title, String authHeader) {
HttpRequestWithBody http =
Unirest.post("https://api.spotify.com/v1/users/" + spotifyId + "/playlists");
try {
HttpResponse<JsonNode> httpResponse = http
.header("Content-Type", "application/json")
.header("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36")
.header("Authorization", authHeader)
.body("{\"name\":\"" + title + "\", \"public\":true}")
.asJson();
JsonNode response = httpResponse.getBody();
return response.getObject();
} catch (Exception e) {
e.printStackTrace();
throw new WrapperException();
}
}
PlaylistService.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:spotify-pull-requests
作者:
评论列表
文章目录