[ckan-discuss] [Fwd: Re: API For Package Name]

John Bywater john.bywater at appropriatesoftware.net
Tue Nov 23 21:34:15 GMT 2010

Hi James,

Just wondering about slugs in the API. Thought I'd copy this to the 
ckan-discuss list, so that others could report whether they prefer:




as the template locator for slug resources within CKAN's RESTful API.

Best wishes,


-------- Original Message --------
Subject: Re: API For Package Name
Date: Mon, 15 Nov 2010 22:40:24 +0000
From: John Bywater <john.bywater at appropriatesoftware.net>
To: James Gardner <james at 3aims.com>
References: <1289828618.2508.6.camel at feynman>

Hi James,

Thank you very much for this email....

James Gardner wrote:
> Hi John,
> How does it sound putting it here:
> /api/2/rest/package/create_slug?title=Package+1+Title+Typed+So
> +Far&callback=callback

How's about we aim for this:

$ curl /api/2/rest/slug/Package+1+Title+Typed+So+Far

That is, would it be okay to isolate slugs as a type of model resource?

In the way of a RESTful API, I would prefer not to pass the input string
as a request parameter, but rather to make it look as if a slug is a
type of API resource that is available using a resource locator formed
from the input string.


We can then avoid mixing slugs with packages (and also tags), and then
also avoid putting the method name "create" in the locator template.

So, as you had it, but without "package", "create", "title", and "?".

If we wanted different flavours (packages names have underscores whilst
tag names have dashes), we could instead publish:


or, to make the types clear:


That would fit well with the original design of the CKAN API. ;-)

> (This is already implemented now so aside from the URL itself I'd prefer
> not to discuss other features!!)

I can't think of anything just now... ;-)

> I prefer slug but do you prefer name?

I prefer slug: who's to say a slug will be used as a name?

Best wishes,


> Cheers,
> James

More information about the ckan-discuss mailing list