QLands
QLands

Reputation: 2586

CKAN - Upload a dataset with tags using API

I am trying to upload a dataset into CKAN using API. All works well is I don't set the tags.

I have tried as an array:

'tags': [u'dairy', u'gender', u'policy', u'value chain', u'value systems'],

Also as a comma separated list:

'tags': u'dairy,gender,policy,value chain,value systems',

But in both cases I get this error:

Format incorrect: Only lists of dicts can be placed against subschema ('tags',), not

How should I upload the tags for a dataset?

Upvotes: 1

Views: 777

Answers (1)

Denis
Denis

Reputation: 890

Try:

tags=[{'name': 'tag1'}, {'name': 'tag2'}]

If you're using the ckanapi python library, this would look like:

import ckanapi
ckan = ckanapi.RemoteCKAN(url, apikey=...)
ckan.action.package_create(name='test', tags=[{'name': 'tag1'}, {'name': 'tag2'}])

Upvotes: 3

Related Questions