<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #377: API Should return JSON in all cases</title>
    <link>http://localhost/ticket/377</link>
    <description>&lt;p&gt;
When the API returns any response it should always retunr JSON. For example a 404 response should return something like
&lt;/p&gt;
&lt;pre class="wiki"&gt;{'status': 404, 'message': 'package somename not found'}
&lt;/pre&gt;&lt;p&gt;
When errors are encountered when creating a package:
&lt;/p&gt;
&lt;pre class="wiki"&gt;{'status': nnn, 'message': 'Validation Errors', 'errors':['description':'name cannot be
blank', 'description':'license code must be an integer']}
&lt;/pre&gt;&lt;p&gt;
Not authorised:
&lt;/p&gt;
&lt;pre class="wiki"&gt;{'status': 503, 'message': 'You are not authorised to create this package.'}
&lt;/pre&gt;&lt;p&gt;
The reason being that screeds of html coming back in the response just makes it harder to debug and understand. Having the proper error codes/messages means that you can see why your package was not created.
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/377</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>johnbywater</dc:creator>

      <pubDate>Wed, 28 Jul 2010 13:21:49 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/377#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/377#comment:1</guid>
      <description>
        &lt;p&gt;
Thanks a lot! I totally agree and have already started working on this. For example, try pointing your browser to &lt;a class="ext-link" href="http://ckan.net/api/search/revision"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://ckan.net/api/search/revision&lt;/a&gt; (ie without any arguments). Also, there is probably a lot less HTML than there was, since the errors are not handled as if it was an error within the "Web" user interface.
At any rate, perhaps we could work through the error cases, filling in the tests as we go? I think it's just unworked ground, rather than anything deliberate. :-)
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>thejimmyg</dc:creator>

      <pubDate>Fri, 07 Jan 2011 14:28:18 GMT</pubDate>
      <title>owner set</title>
      <link>http://localhost/ticket/377#comment:2</link>
      <guid isPermaLink="false">http://localhost/ticket/377#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;owner&lt;/strong&gt;
              set to &lt;em&gt;thejimmyg&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>ross</dc:creator>

      <pubDate>Mon, 28 May 2012 11:58:50 GMT</pubDate>
      <title>status changed; repo, theme set; owner deleted</title>
      <link>http://localhost/ticket/377#comment:3</link>
      <guid isPermaLink="false">http://localhost/ticket/377#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;owner&lt;/strong&gt;
              &lt;em&gt;thejimmyg&lt;/em&gt; deleted
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt;
                set to &lt;em&gt;ckan&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;theme&lt;/strong&gt;
                set to &lt;em&gt;none&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;assigned&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
We have another ticket for fixing the API
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>ross</dc:creator>

      <pubDate>Mon, 28 May 2012 11:59:09 GMT</pubDate>
      <title>status changed; resolution, milestone set</title>
      <link>http://localhost/ticket/377#comment:4</link>
      <guid isPermaLink="false">http://localhost/ticket/377#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;assigned&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;wontfix&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                set to &lt;em&gt;ckan-future&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>