At the moment I'm trying to write a process (in Python) to update a metadata record in GeoNetwork 3.10.2, which we have running on our intranet recently. Unfortunately, I'm unable to figure out how to do automated updates to specific properties of the record, such as the last update time and a dataset version id. I found /srv/eng/admin.console#/settings/csw-test that shows a list of what I'm able to do through the API, but so far I have been successful mostly in blowing up a few test records - I get a ISO date error which leaves the record void of metadata.

From what I tried, I have been unable to extract a working cURL command from the csw-test page to translate to Python code. From the network console I can extract some information, but it's not enough to replicate - even the blow-up behaviour. Also, it includes use of a cookie that I would like to get rid of in production.

From the REST API side, I am clueless on how to operate either the /{portal}/api/0.1/records/{metadataUuid}/editor or the /geonetwork/srv/eng/xml.metadata.update endpoints - I cannot find sufficient documentation on how to operate these.

So, let's say I want to update some fields the summary - how do I go about this?

Any pointers in posix cURL format or Python would be very, very helpful. Thanks in advance.

EDIT: I've auto-generated the Python code for the /editor endpoint to try and figure out how this is supposed to work. Bootstrapping the code works using

wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.15/swagger-codegen-cli-2.4.15.jar -O swagger-codegen-cli.jar
java -jar swagger-codegen-cli.jar generate -i https://your_geonetwork/srv/v2/api-docs -l python -o ./python_geonetwork_client

but the code itself results in authentication errors, using basic authentication methods.

EDIT2: Unable to make a working GET call to {portal}/api/0.1/records/{metadata_uuid}/editor work in Postman, also due to access denied errors. Following https://geonetwork-opensource.org/manuals/trunk/en/api/the-geonetwork-api.html using basic authentication

  • I found some wiki information here with Python sample code on CSW transactions, but unfortunately it describes only the login procedure. Also: it hasn't been updated in 7 years... – Rein Aug 19 '20 at 7:23
  • CSW is an old specification which would explain no new documentation. You might look elsewhere for CSW transactional examples like INSERT and UPDATE for example ~ docs.oracle.com/cd/E11882_01/appdev.112/e11830/… – nmtoken Aug 24 '20 at 15:33
  • Oooh nice @nmtoken that link hadn't popped up in my search results yet, thanks. I'll definitely be looking into that! – Rein Aug 25 '20 at 17:00

AstunTechnology was kind enough to point me to a repository for updating metadata records in GeoNetwork: https://github.com/AstunTechnology/geonetwork-utility-scripts/blob/master/os_update_revisiondate.py

The quickest route to getting answers to questions regarding GeoNetwork appears (at the moment of writing) to be the mailing lists which can be found at https://sourceforge.net/p/geonetwork/mailman/ for anyone. The answer to my question was archived here: https://sourceforge.net/p/geonetwork/mailman/message/37105243/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.