GeoServer REST API - PUT datastore using URL method option

Geographic Information Systems Asked on November 30, 2020

According to the swagger API documentation, one should be able to create a new datastore in GeoServer using the method url option in a PUT.

My attempts to do this have failed so far, so I’m wondering if anyone has any pointers.

Given a shapefile_url pointing a zip file of Shapefile context. E.g., I try to upload it to an existing workspace named public.

curl -v -i --user admin:geoserver -H "Content-Type: text/plain" -X PUT -d "$shapefile_url" "$geoserver_base/workspaces/public/datastores/hillshade/url.shp"

The response I get is:

*   Trying ::1:8080...
* Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'admin'
> PUT /geoserver/rest/workspaces/public/datastores/hillshade/url.shp HTTP/1.1
> Host: localhost:8080
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.72.0
> Accept: */*
> Content-Type: text/plain
> Content-Length: 90
* upload completely sent off: 90 out of 90 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 500
HTTP/1.1 500
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Content-Type: text/plain
Content-Type: text/plain
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Fri, 09 Oct 2020 18:34:08 GMT
Date: Fri, 09 Oct 2020 18:34:08 GMT
< Connection: close
Connection: close

* Closing connection 0
java.lang.RuntimeException: Wrong magic number, expected 9994, got 1347093252

Clearly I’m missing something, or what I’m trying to do isn’t possible.

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP