[ckan-dev] How to access an array in extra-fields ?

Pascal Christoph christoph at hbz-nrw.de
Tue May 3 10:36:38 UTC 2011


David,

> It's great you're using our API and pushing us on it! Allow me to
> summarise your issues (correct if necessary) and where we're at with
> them.

It's great you have this fine API!
thanx for your effort - this' all working now :)

Am 02.05.2011 22:44 schrieb David Read:
> Storing lists, tuples & dicts in extra fields is something we want to
> support for harvesting, but I wasn't aware this was a feature
> wanted/needed be front end users. I guess you could store the list
> quoted, so it is stored as a JSON string, rather than something that
> acts like a collection and hence confuses the form & search, but would
> that make life harder for you Pascal?

why, no, good idea, that is feasible for us - just tested this, it works:

wget
'http://ckan.net/api/1/search/package?filter_by_openness=1&publishingInstitution=http*//lobid.org/organisation/DE-605*'

Being myself a programmer I eventually *had to* think about tuples
because searching in tuples would be easier for solr. But as far as the
machines are not complaining I won't either ;)

> BTW I failed to mention you can POST parameters. These examples (now)
> all give the same response:
> 
> curl 'http://ckan.net/api/1/search/package?q=lobid&filter_by_openness=1'
> curl 'http://ckan.net/api/1/search/package' -d 'q=lobid&filter_by_openness=1'
> curl 'http://ckan.net/api/1/search/package' -d '{"q": "lobid",
> "filter_by_openness": "1"}'

these may be more elegant when it comes to more complexity, thanks.

oo

> On 29 April 2011 09:36, David Raznick <kindly at gmail.com> wrote:
>>
>>
>> On Thu, Apr 28, 2011 at 4:57 PM, William Waites <ww at styx.org> wrote:
>>>
>>> * [2011-04-28 16:44:09 +0100] David Raznick <kindly at gmail.com> écrit:
>>>
>>>
>>> ] It should be getting a json dumps only if its *not* a plain string.  It
>>> is
>>> ] stored as a json but on return to the wui it gets converted to the
>>> repred
>>> ] version.
>>>
>>> If I'm not mistaken the OP is using the API and gets, inter alia,
>>>
>>>    "extras": {"publishingInstitution":
>>>    "[u'http://lobid.org/organisation/DE-605',
>>>
>>> Note the u'...' smoking gun...
>>>
>> The u' ' has been fixed but it is tangential to the OP issue.
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>
>>
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list