Open davidmichaelhuber opened 6 years ago
I have the same question as well. Seems like it doesn't have a syntax for arrays -__-
@stcalica Actually I think it supports arrays because items
is one as well. But nested arrays get ignored somehow.
Ah, I didn't realize that. Yes I believe it does ignore nested arrays. Hopefully they fix this, soonish :/
My workaround is just grabbing it as is and retrieving it in my own code.
I also have this issue. Any update?
I also have this issue. Any update?
Unfortunately I didn't dig into it any further.
I'm having the same issue. My assumption is that this behavior is due to the fact that you can have multiple artists for one track. Therefore:
track.artist.name
maybe doesn't exist since it would really be:
track.artists.artist.name
However, I tried a few iterations of field names and syntaxes and got nowhere.
I'm having the same issue. I also think nested arrays are the problem, since items
is an array.
I'm hitting the same issue. Admittedly, it's not a huge deal, since I can just ignore the unrequested data. Still, it's kind of annoying. @rohansingh, do you know anyone who can look into this?
Same issue for me as well
+1
been at this for a while, would also appreciate a fix
Add me to the list too.
Same issue here
+1
I am able to pull every other field from API, but any selector in artists object. Track names, album names, popularity, duration... everything is ok, but artists. I'm going crazy. If I write {{items.0.track.artists}} I get an object return, but {{items.0.track.artists.name}} returns nothing. Did anyone face that before?
Figured from the same issue's Stackoverflow page. Just so if anyone has the same, if you type {{items.0.track.artists.0.name}} it works apparently I had to tell the index number again after artists object
Correct, @umitao That follows what we've been saying, that it's a nested array. But this bug is specifically about not being able to tell the API to give you only that data. Since it's working for you, I'm assuming that means you got all the fields from the API and then filtered on the client side, right? I haven't played with this in a while, but if that query worked directly against the API this bug might have been fixed.
Actually I was playing with the web interface before I used it in code, and after looking again, I noticed the bug is still there. It returns all the artists' attributes even though I did not type it in the fields. I just coded it first time today and yes I am only printing artist name in HTML, so you are right and for sure the bug is still there.
What got me thinking is actually the index of the artists array. If I want to print artists name (or any other attribute), the index is always 0 : {{items.5.track.artists.0.name}}
and {{items.5.track.artists.0.href}}
I also later realized that artists object always returns every value in Simplified artist object.
+1
Introduction
I am using this endpoint of the Spotify Web API. I am using the
fields
query parameter in order to solely request the data I am going to need.Problem
Without any filtering the JSON returned from the API will contain an array called
items
. The first key in each object ofitems
is calledadded_at
. In order to receive this key only the fields parameter needs to beitems(added_at)
.There is another key in each object of
items
calledtrack
. Withintrack
there is an array calledartists
. Each entry ofartists
has a key calledname
. So this should be the same situation as described in the second paragraph. Therefore I should get the names of the artists only by usingitems(track(artists(name)))
.Actually this does always return the whole
artists
array. It seems like the(name)
selector is ignored.Example
The responses for
items(added_at, track(artists))
&items(added_at, track(artists(name)))
are actually the same and look like this:Question
So how can I filter the artists array to only show the name of the artists by using query parameters? Am I wrong about the assumption that
items
&added_at
can be compared toartists
&name
and therefore the syntax I use is wrong or is there something else that I am missing?Edits
items(track.artists(name))
&items(track.artists)
.