B4J Question Spotify API question

woniol

Active Member
Licensed User
Longtime User
Hi,
I try to use Spotify API to get Current User's Recently Played Tracks https://developer.spotify.com/web-api/web-api-personalization-endpoints/get-recently-played/
with this code:
B4X:
Private Sub GetPlayedTrack
    Dim Job As HttpJob
    Job.Initialize("spoti", Me)
    Job.Download("https://api.spotify.com/v1/Me/player/recently-played")
    Job.GetRequest.SetHeader("Authorization","Bearer " & API_KEY)
    Job.GetRequest.SetHeader("Accept","application/json")
    Job.GetRequest.SetHeader("ContentType","application/json")   
End Sub

and in the JobDone Sub I always get
B4X:
success = false

Any help how to use this API with b4J?

working curl example:
B4X:
curl -X GET "https://api.spotify.com/v1/me/player/recently-played" -H "Accept: application/json" -H "Authorization: Bearer ....................."
 
Top