[ckan-dev] How to access an array in extra-fields ?
David Read
david.read at okfn.org
Thu Apr 28 14:41:33 UTC 2011
On 28 April 2011 15:55, Pascal Christoph <christoph at hbz-nrw.de> wrote:
> Hello *,
>
> we encountered a Problem concerning accessing Arrays/Lists.
>
> curl -XGET 'http://ckan.net/api/rest/package/hbz_unioncatalog'
>
> will get you amongst others:
>
> "extras": {"publishingInstitution":
> "[u'http://lobid.org/organisation/DE-605',
> u'http://lobid.org/organisation/DE-290',
> u'http://lobid.org/organisation/DE-38M',
> u'http://lobid.org/organisation/DE-98',
> u'http://lobid.org/organisation/DE-38',
> u'http://lobid.org/organisation/DE-Kn41',
> u'http://lobid.org/organisation/DE-82',
> u'http://lobid.org/organisation/DE-107',
> u'http://lobid.org/organisation/DE-929',
> u'http://lobid.org/organisation/DE-Zw1',
> u'http://lobid.org/organisation/DE-832']"}
>
> but if I try to query this:
>
> wget
> 'http://ckan.net/api/search/package?q=lobid&publishingInstitution="http://lobid.org/organisation/DE-605"'
>
> I get only two packages, among the package "hbz_unioncatalog" is
> missing. (These two packages have only one value for
> "publishingInstitution").
It looks like a quoting problem in your command. This gives a result
of 15 packages including the hbz_unioncatalog:
wget http://ckan.net/api/search/package?q=lobid&publishingInstitution="http://lobid.org/organisation/DE-605"
> The "extra/publishingInstitution"-Array was uploaded through a "curl
> -XPUT ...
> "extras": {
> "publishingInstitution":[
> "http://lobid.org/organisation/DE-605",
> "http://lobid.org/organisation/DE-290",
> "http://lobid.org/organisation/DE-38M",
> "http://lobid.org/organisation/DE-98",
> "http://lobid.org/organisation/DE-38",
> "http://lobid.org/organisation/DE-Kn41",
> "http://lobid.org/organisation/DE-82",
> "http://lobid.org/organisation/DE-107",
> "http://lobid.org/organisation/DE-929",
> "http://lobid.org/organisation/DE-Zw1",
> "http://lobid.org/organisation/DE-832"
> ]
> },
> ...
>
> is there somethin wrong with?
>
> Further, I discovered apparently a bug resp. an inconistency:
> when editing this "extra/publishingInstitution"-Field by hand through
> http://ckan.net/package/edit/hbz_unioncatalog
> the array/list will be broken when saved.
>
> Do you know what to I shall do?
>
> -o
>
> _______________________________________________
> 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