[ckan-dev] Assign an image to an organization via the API

Denis Zgonjanin deniszgonjanin at gmail.com
Mon Jul 6 14:04:29 UTC 2015


Hi Milica,

Using the ckanapi library (https://github.com/ckan/ckanapi), you can do it
like this:

ckan = ckanapi.RemoteCKAN('http://myckan.org', apikey='mykey')
ckan.action.organization_create(name='MyOrganization',
image_upload=open('myorg.png'))

- Denis

On Mon, Jul 6, 2015 at 4:36 AM, Milica Knezevic <knezevic.milica at gmail.com>
wrote:

> Hi,
>
> If I want to create an organization with an image to be displayed on the
> organization’s page, how can I do that via the API? organization_create has
> an (optional) field image_url which should contain the URL of the image,
> but when creating an organization I want to upload and image and assign it
> to organization, so I start with a file (containing the image) and no URL.
> What would be the steps I need to take?
>
> I'm working with CKAN version 2.2.1
>
> m.
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150706/d6602538/attachment-0003.html>


More information about the ckan-dev mailing list