<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bug in Search API: Always returning null in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5607315#M9943</link>
    <description>&lt;P&gt;Actually the market parameter is not needed for Search, it will take the market from the user's token instead.&amp;nbsp; OP's issue is that he was using a plus (+) in his q string when it should have been a space.&amp;nbsp; You'll see if you search in the Spotify app for "artist:Kendrick Lamar+track:good kid" it will return nothing.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2023 07:21:09 GMT</pubDate>
    <dc:creator>SpotifyTom</dc:creator>
    <dc:date>2023-07-10T07:21:09Z</dc:date>
    <item>
      <title>Bug in Search API: Always returning null</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5318281#M3826</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Germany&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hello fellow developers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently experiencing an issue with the &lt;A href="https://developer.spotify.com/documentation/web-api/reference/#/operations/search" target="_blank" rel="noopener"&gt;/search&lt;/A&gt; endpoint in the API. My ultimate goal is to obtain the Spotify IDs for songs listed in the listening history JSON files (which only contain title and artist).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When GETting the endpoint with the required parameters I always get an empty response with this payload:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{\n  "tracks" : {\n    "href" : "https://api.spotify.com/v1/search?query=artist%3AKendrick%2520Lamar%2Btrack%3Agood%2520kid&amp;amp;type=track&amp;amp;offset=0&amp;amp;limit=20",\n    "items" : [ ],\n    "limit" : 20,\n    "next" : null,\n    "offset" : 0,\n    "previous" : null,\n    "total" : 0\n  }\n}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the provided parameters in the URL, here are the required Auth headers for that request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;headers = {
        "Authorization" : f"Bearer {access}",
        "Accept" : "application/json",
        "Content-Type" : "application/json"
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable "access" is a valid access token acquired through the &lt;A href="https://developer.spotify.com/documentation/general/guides/authorization/code-flow/" target="_self"&gt;auth code flow&lt;/A&gt;, I have verified that it works through the get playlist items endpoint, which works flawlessly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same thing btw happens when using the official &lt;A href="https://developer.spotify.com/console/get-search-item/" target="_self"&gt;Spotify API console&lt;/A&gt; with a generated access token (see attached screenshot).&lt;/P&gt;&lt;P&gt;So in short, I'm reporting that the /search endpoint is not working for me, can others reproduce this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Python code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def getSongId(access: str, title: str, artist: str):
    url = "https://api.spotify.com/v1/"
    endpoint = "search"
    data = {
        "q" : f"artist:{artist}+track:{title}",
        "type" : ["track"]
    }
    headers = {
        "Authorization" : f"Bearer {access}",
        "Accept" : "application/json",
        "Content-Type" : "application/json"
    }
    resp = requests.get(url=url+endpoint,params=data,headers=headers)
    print(resp.content)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: would there be another way to programmatically obtain Spotify IDs for songs of whom only title and artist are known when the /search endpoint turns out to be broken?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 11:03:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5318281#M3826</guid>
      <dc:creator>Marius_Ne</dc:creator>
      <dc:date>2021-12-21T11:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Search API: Always returning null</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5606775#M9930</link>
      <description>&lt;P&gt;Just ran into the same issue. All you need to do is add the `market` parameter.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2023 15:32:20 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5606775#M9930</guid>
      <dc:creator>bkeys818</dc:creator>
      <dc:date>2023-07-08T15:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Search API: Always returning null</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5607315#M9943</link>
      <description>&lt;P&gt;Actually the market parameter is not needed for Search, it will take the market from the user's token instead.&amp;nbsp; OP's issue is that he was using a plus (+) in his q string when it should have been a space.&amp;nbsp; You'll see if you search in the Spotify app for "artist:Kendrick Lamar+track:good kid" it will return nothing.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 07:21:09 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Bug-in-Search-API-Always-returning-null/m-p/5607315#M9943</guid>
      <dc:creator>SpotifyTom</dc:creator>
      <dc:date>2023-07-10T07:21:09Z</dc:date>
    </item>
  </channel>
</rss>

