0

I am exploring GeoNetwork to get if it is suitable for my purpose.

I need to use a script to upload several metadata with a file JSON associated. Is there any chance to use CSW / API to upload the files to the filestore available in the GUI (https://geonetwork-opensource.org/manuals/trunk/en/user-guide/associating-resources/using-filestore.html) ?

  • When you say with a JSON file associated, what do you mean? Do you mean the metadata to be uploaded is JSON, or do you mean that the data being described by the metadata is JSON? or something else, sorry it isn't clear. – nmtoken May 15 '20 at 15:49
  • I mean the data being described by the metadata is JSON – Federico Oldani May 16 '20 at 17:31
1

You'd need two calls, one to the CSW-T service to create the metadata record and other to store the JSON file in the filestore using the GeoNetwork API: POST /{portal}/api/0.1/records/{metadataUuid}/attachments

You can check the parameters here https://vanilla.geocat.net/geonetwork/doc/api/index.html#/records/putResourceFromFile

  • Thank you, didnt notice that API! – Federico Oldani May 18 '20 at 7:21
  • EDIT: I tried the API directly from Swagger and through Postman. In both the cases, I faced with Error 403 Forbidden. I used my user and pwd on Swagger, I used my user and pwd as basic auth on Postman. How can I authenticate this API? – Federico Oldani May 19 '20 at 8:41
  • That's probably caused because GN is not receiving the right XSRF token. Check the API guide at geonetwork-opensource.org/manuals/trunk/en/api/… – juanluisrp May 19 '20 at 11:53

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.