[Geoserver-users] Upload a file from local machine to remote Geoserver data directory

Hello!

I’m struggling to understand, is there a way to automate file transfer from a local machine to remote geoserver using curl or anything else (other than manually copy-paste to server’s file system)?

The goal is to take a local geotiff (I get new files every day) and transfer it to the image mosaic directory inside the remote geoserver instance so I could harvest new granules using curl command.

I tried to «upload resource» using this command:

curl -u login:pw -XPUT -H “Content-type:application/zip” @20220701.zip {host}/geoserver/rest/resource/coverages/test_data

but it returns 405 informing that I’m attempting to write data to a directory…well, that’s what I’m trying to achieve but apparently using the wrong way.

P.S. I guess packing tif into zip was a mistake but don’t really know what content-type to use for it.


Sincerely,
Yaras

Install the web-resource extension and you can use a user interface (uses the same rest api as you have below). Uploading a zip should be fine; and the importer extension knows how to unzip.

You may also just want to setup a webdav folder for remote management of files and map it to GEOSERVER_DATA_DIR/data

There are a couple community extensions that can help; including one that does resumeable upload.

If you are just trying to manually manage granules there is a specific rest api for that.

···


Jody Garnett