Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Plan
Free/Premium
Country
USA
Device
iMac Late 2014
Operating System
macOS Big Sir 11.6.4 (20G417)
My Question or Issue
When I attempt to execute the following query, either with Python or with the Spotify Developer Console, I get a 404 error. Does this error occur because of a query string length? If YES, what is the limit? Below is the code from the console:
curl -X "GET" "https://api.spotify.com/v1/search?q=artist%3APorridge%20Radio%20track%3AWaterslide%2C%20Diving%20Board%2C%20Ladder%20to%20the%20Sky%20album%3AWaterslide%2C%20Diving%20Board%2C%20Ladder%20to%20the%20Sky&type=track" -H "Accept: application/json" -H "Content-Type: application/json" -H
And this is the output:
{ "error": { "status": 404, "message": "Not found." } }
If I run this query without the Album Name, I do not get the error, but I get no results:
curl -X "GET" "https://api.spotify.com/v1/search?q=artist%3APorridge%20Radio%20track%3AWaterslide%2C%20Diving%20Board%2C%20Ladder%20to%20the%20Sky&type=track&market=US" -H "Accept: application/json" -H "Content-Type: application/json" -H
Result:
{ "tracks": { "href": "https://api.spotify.com/v1/search?query=artist%3APorridge+Radio+track%3AWaterslide%2C+Diving+Board%2C+Ladder+to+the+Sky&type=track&market=US&locale=en-US%2Cen%3Bq%3D0.5&offset=0&limit=20", "items": [ { "album": { "album_type": "album", "artists": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/4vAQ4M7vgItwBtmBTgRu48" }, "href": "https://api.spotify.com/v1/artists/4vAQ4M7vgItwBtmBTgRu48", "id": "4vAQ4M7vgItwBtmBTgRu48", "name": "Porridge Radio", "type": "artist", "uri": "spotify:artist:4vAQ4M7vgItwBtmBTgRu48" } ], "external_urls": { "spotify": "https://open.spotify.com/album/6wdThJ2V58nkaWfv1jA4B5" }, "href": "https://api.spotify.com/v1/albums/6wdThJ2V58nkaWfv1jA4B5", "id": "6wdThJ2V58nkaWfv1jA4B5", "images": [ { "height": 640, "url": "https://i.scdn.co/image/ab67616d0000b27303a583cc04f4005d5c81623d", "width": 640 }, { "height": 300, "url": "https://i.scdn.co/image/ab67616d00001e0203a583cc04f4005d5c81623d", "width": 300 }, { "height": 64, "url": "https://i.scdn.co/image/ab67616d0000485103a583cc04f4005d5c81623d", "width": 64 } ], "name": "Waterslide, Diving Board, Ladder To The Sky", "release_date": "2022-05-20", "release_date_precision": "day", "total_tracks": 13, "type": "album", "uri": "spotify:album:6wdThJ2V58nkaWfv1jA4B5" }, "artists": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/4vAQ4M7vgItwBtmBTgRu48" }, "href": "https://api.spotify.com/v1/artists/4vAQ4M7vgItwBtmBTgRu48", "id": "4vAQ4M7vgItwBtmBTgRu48", "name": "Porridge Radio", "type": "artist", "uri": "spotify:artist:4vAQ4M7vgItwBtmBTgRu48" } ], "disc_number": 1, "duration_ms": 202720, "explicit": false, "external_ids": { "isrc": "US38W2145013" }, "external_urls": { "spotify": "https://open.spotify.com/track/0on6oBOc1ZpX8FoeKSl8yK" }, "href": "https://api.spotify.com/v1/tracks/0on6oBOc1ZpX8FoeKSl8yK", "id": "0on6oBOc1ZpX8FoeKSl8yK", "is_local": false, "is_playable": true, "name": "Waterslide, Diving Board, Ladder To The Sky", "popularity": 37, "preview_url": "https://p.scdn.co/mp3-preview/b71b236a8359ef63e1bee616c78d075fd0b2fbfd?cid=774b29d4f13844c495f206cafdad9c86", "track_number": 13, "type": "track", "uri": "spotify:track:0on6oBOc1ZpX8FoeKSl8yK" } ], "limit": 20, "next": null, "offset": 0, "previous": null, "total": 1 } }
You are using type=track instead of type=album.
Ignore my comment, I think I did understand your problem wrong.
I got here while searching for answers to the same question.
Yes, there seems to be a limit to the "q" parameter length and it seems to be 100 characters (found by trial and error). This is another case where Spotify API insists to be frustrating to use.
Why there needs to be a limit at all? Any modern infrastructure should be able to easily handle long query strings at the request or data query level. And why does it needs to be so low?
Why does it return 404 error? A more accurate http error code (and error message) could help diagnose the problem (400, 414).
At the very least, this should be documented. Wasted too much time debugging this.
I am using both. The track name and the album name are the same (in this example).
@jospkelly wrote:I am using both. The track name and the album name are the same (in this example).
It seems to be the total length of the "q" URL parameter (before it's url encoded).
In your first example (with album) it's 121 characters, the request fails with the cryptic 404 error.
In your second example (without album) it's 71 characters. The request is successful and it returns 1 track item because you specified the type of the search as "track".
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game…