[ckan-discuss] Delete packages with api - 403 error

Sean Hammond sean.hammond at okfn.org
Mon May 27 10:40:29 BST 2013


> I have some problems with my CKAN2.0 installation.
> At first I want to create a package via the rest api. Here is a short section from my python code:

The rest api is deprecated and only remains for backwards-compatibility
with legacy API apps. See the action API docs:

http://docs.ckan.org/en/ckan-2.0/api.html

> It worked fine but now I want to delete it and I get the error code 403. My code:
>  
> action_url = host + "/api/action/package_delete"
> api_key = 'xxx'
> request = urllib2.Request(action_url,'{"id":"testobject4"}')
> request.add_header('Authorization', api_key)
> response = urllib2.urlopen(request)
>  
> I think HTTP error no. 403 means that I have no permission for this action.
> But why? I used the same api key as I created the package.

Are you really getting an HTTP 403 response? The action api should
always return 200 OK, but if there was an error it returns an error in
its JSON dict.

Is there any more info in the response from CKAN?



More information about the ckan-discuss mailing list