Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json Parsing error internal #489

Open
Jacob-Tate opened this issue Aug 9, 2024 · 1 comment
Open

Json Parsing error internal #489

Jacob-Tate opened this issue Aug 9, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Jacob-Tate
Copy link

Describe the bug
When attempting to use the show query code I get the following error this doesnt occur on the track search

To Reproduce

let creds = Credentials::new("redacted","redacted");
let client = ClientCredsSpotify::new(creds);
client.request_token().await.unwrap();

let show_query = "love";
let result = client.search(show_query, SearchType::Show, None, None, Some(10), None).await;
match result {
     Ok(show) => println!("Searched show: {show:?}"),
     Err(err) => println!("Search error! {err:?}"),
}

Log/Output data
Search error! ParseJson(Error("invalid type: null, expected struct SimplifiedShow", line: 4, column: 20))

@Jacob-Tate Jacob-Tate added bug Something isn't working help wanted Extra attention is needed labels Aug 9, 2024
@ramsayleung
Copy link
Owner

ramsayleung commented Sep 13, 2024

I can reproduce this problem with curl:

·> curl --request GET \
  --url 'https://api.spotify.com/v1/search?limit=10&q=love&type=show' \
  --header 'Authorization: Bearer MyToken'
{
  "shows" : {
    "href" : "https://api.spotify.com/v1/search?query=love&type=show&offset=0&limit=10",
    "items" : [ null, null, null, null, null, null, null, null, null, null ],
    "limit" : 10,
    "next" : "https://api.spotify.com/v1/search?query=love&type=show&offset=10&limit=10",
    "offset" : 0,
    "previous" : null,
    "total" : 209
  }
}%

According to the Spotify's document:

If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.
Note: If neither market or user country are provided, the content is considered unavailable for the client.
Users can view the country that is associated with their account in the account settings.

You have not specified any country in your request, it means Spotify was using the country associated with your account, if you haven't set a country in your account setting, no show is available for you, so it return list of null.

In order to fix the above problem, you could simply specify a country like market=US

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants