I’m assuming that “/test_data” is a directory? If so, then you’re simply 
missing the target filename in your curl command:

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

If the zip is just a single tiff file, then why not just write it with -H 
“Content-type: image/tiff”?

Erhhung

From: Jody Garnett <jody.garn...@gmail.com>
Date: Tuesday, August 9, 2022 at 6:53 AM
To: Ярослав Минин <yaras_phoe...@inbox.ru>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Upload a file from local machine to remote 
Geoserver data directory
EXTERNAL EMAIL: Do not click any links or open any attachments unless you trust 
the sender and know the content is safe.
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

On Tue, Aug 9, 2022 at 3:16 AM Ярослав Минин via Geoserver-users 
<geoserver-users@lists.sourceforge.net<mailto:geoserver-users@lists.sourceforge.net>>
 wrote:
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
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net<mailto:Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
--
Jody Garnett
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to