Giter Club home page Giter Club logo

Comments (4)

praweshsth avatar praweshsth commented on July 17, 2024

To add on to this: we did that in staging of IATI Registry

from ckanext-iati.

cormachallinanderilinx avatar cormachallinanderilinx commented on July 17, 2024

Hi @robredpath

I can confirm the data purge works on IATI.
As per the CKAN docs to delete a dataset the endpoint is package_delete
To purge the endpoint is dataset_purge

Also what username is trying to do the, they must be an admin on the publisher they are trying to purge the dataset on. Or else a superadmin

I created a script here which works for me on staging:

import requests
from requests.auth import HTTPBasicAuth
api_token = 'INSERT_OWN_TOKEN'

headers = {
'X-CKAN-API-Key': api_token,
'Content-Type': 'application/json',
}
username = "BASIC_AUTH_USERNAME"
password = "BASIC_AUTH_PASSWORD"
auth = HTTPBasicAuth(username, password)

IATI_STAGING_API_URL = 'https://staging.iatiregistry.org/api/action/'
PACKAGE_ID = 'test-cormac-delete-me'

package = requests.get(IATI_STAGING_API_URL + f'package_show?id={PACKAGE_ID}', headers=headers, auth=auth)

print(package)
package_delete = requests.post(IATI_STAGING_API_URL + 'package_delete',
json={'id': PACKAGE_ID},
headers=headers,
auth=auth
)
print(package_delete.dict)

package_purge = requests.post(IATI_STAGING_API_URL + 'dataset_purge',
json={'id': PACKAGE_ID},
headers=headers,
auth=auth
)
print(package_purge.dict)

from ckanext-iati.

PG-Momik avatar PG-Momik commented on July 17, 2024

@cormachallinanderilinx
Apologies, I was testing using the endpoint package_purge. Purging works fine when using the endpoint dataset_purge.

Thank you

from ckanext-iati.

robredpath avatar robredpath commented on July 17, 2024

Thanks for looking into this @cormachallinanderilinx; glad you got it sorted @PG-Momik

As per the CKAN docs to delete a dataset the endpoint is package_delete
To purge the endpoint is dataset_purge

Now that's a trap for the unwary!

from ckanext-iati.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.