Open FrankBJensen opened 1 month ago
I have the same issue, no luck in solving it.
Hi,
Do the endpoints work in the web api console? Can you also give the whole stack trace?
Hi Johnny.
I am on vacation, and right now my teamviewer do not connect to my home station... :-/ But I might be able to get the complete log entry from windows, I do not know if that contains what you need. I will check the web api console later.
Additional info:
This call is also throwing same error:
await spotify.Player.PausePlayback(new PlayerPausePlaybackRequest() { DeviceId = deviceID } );
However, this call is NOT, and working as usual
playing = await spotify.Player.ResumePlayback(new PlayerResumePlaybackRequest() { DeviceId = deviceID, ContextUri = param1, OffsetParam = new PlayerResumePlaybackRequest.Offset { Uri = param2 } });
So I am able to start playing a song, get artist info, play state and so, but not to pause it. I have a feeling that Spotify changed the syntax or expects some more parameters for some API calls.
I'll also add here that for (at least) me this works but throws an error.
I mean for example the await spotify.Player.SkipNext();
will throw an error, but the spotify client will skip the song.
The error is:
Newtonsoft.Json.JsonReaderException: Error parsing boolean value. Path '', line 1, position 1. at Newtonsoft.Json.JsonTextReader.ParseTrue() at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at SpotifyAPI.Web.Http.NewtonsoftJSONSerializer.DeserializeResponse[T](IResponse response) at SpotifyAPI.Web.Http.APIConnector.DoSerializedRequest[T](IRequest request, CancellationToken cancel) at SpotifyAPI.Web.Http.APIConnector.SendAPIRequestDetailed(Uri uri, HttpMethod method, IDictionary`2 parameters, Object body, IDictionary`2 headers, CancellationToken cancel) at SpotifyAPI.Web.Http.APIConnector.Post(Uri uri, IDictionary`2 parameters, Object body, CancellationToken cancel) at SpotifyAPI.Web.PlayerClient.SkipNext(CancellationToken cancel) at TurtegBot.Commands.Spotify.skip.InvokeAsync(CommandProps props) in C:\Users\kapim\source\repos\turtegbot\TurtegBot\Commands\Spotify\skip.cs:line 29
Hi again.
I can confirm, that catching - and ignoring - the exception actually works for SetShuffle, SetRepeat, SkipNext and PausePlayback - the calls do what they are supposed to do.
So the API seems to work, except the the faulty exception.
The exception text is not quite the same for these 4, but they are all Unexpected character encountered while parsing.
I think the problem is that the Spotify team has changed the API
A similar issue in the TypeScript client: https://github.com/spotify/spotify-web-api-ts-sdk/issues/119
Thought so, we had this happen twice in the last year. Let's see if they will fix this short term
Is there anywhere we can follow/push on this issue with Spotify? I can remove the feature from my app for now but would like to be able to reinstate it in the future
Yea that's the other problem. They basically don't have any public relations since the layoffs/this year.
https://x.com/SpotifyPlatform is basically dead, last engagement was last year https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer is completely ignored. Bugs reported there get no answer or resolution. See this example https://status.spotify.dev/ is down since last year too
Can't understand how a platform with 615 million users:
My 2 cents, Spotify does not care about this API anymore and it's basically running on maintance mode with barely any resources to work on it.
For now, I'm not yet convinced adding non-JSON response parsers is the way to go, spotify needs to fix this. If you just want it to work, wrap the call in a try-catch
and ignore the response parsing error.
I've implemented a workaround using custom JSON serializer. It might be easier if you have many calls to these unhealthy endpoints.
public class JsonSerializerDecorator : IJSONSerializer
{
private readonly NewtonsoftJSONSerializer _jsonSerializer = new();
public void SerializeRequest(IRequest request)
{
_jsonSerializer.SerializeRequest(request);
}
public IAPIResponse<T> DeserializeResponse<T>(IResponse response)
{
try
{
return _jsonSerializer.DeserializeResponse<T>(response);
}
catch (JsonReaderException)
{
return new APIResponse<T>(response);
}
}
}
Usage:
var config = SpotifyClientConfig.CreateDefault()
.WithJSONSerializer(new JsonSerializerDecorator());
var spotify = new SpotifyClient(config);
Hi.
Happy user of the API, running in a C# windows enviroment, using latest 7.1.1, .net and .net framework 4.8.1. I have same program running on several machines, and I updated my code to ver. 7 looong time ago, and it has been running quite nicely since.
But a couple of days ago, some calls have been failing, and I am not quote sure why. Has something been changed??
shuffle = await spotify.Player.SetShuffle(new PlayerShuffleRequest(true) { DeviceId = deviceID }); repeat = await spotify.Player.SetRepeat(new PlayerSetRepeatRequest(PlayerSetRepeatRequest.State.Context) { DeviceId = deviceID }); await spotify.Player.SkipNext(new PlayerSkipNextRequest() { DeviceId = deviceID } );
and there might be more, havent tested them allresults in a Exception thrown: 'Newtonsoft.Json.JsonReaderException' in mscorlib.dll An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in mscorlib.dll but was not handled in user code Unexpected character encountered while parsing value: k. Path '', line 0, position 0
Does anyone else have this problem? How can I resolve this?