[Geoserver-users] trying to create a layer for a coveragestore using the rest API

Hello all,

I have created a coveragestore in geoserver using the rest API like this:

curl -u admin:geoserver -v -XPOST -H “Content-type: text/xml” –T C:\Users\katie\Desktop\pyramidstore.xml http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores?configure=all

My xml was this:

walkerpyramid

walkerpyramid test

ImagePyramid

true

walker

<__default>false</__default>

file:F:\gis\geotiffs\pyramid3

Next I wanted to create a layer for the coverage store, so I tried this:

curl -v -u admin:geoserver -XPOST -H “Content-type: text/xml” -d “walkerpyramid” http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/coverages

However, this gave me the following error:

  • About to connect() to localhost port 8080 (#0)
  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

POST /geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/coverages
HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1
Host: localhost:8080
Accept: /
Content-type: text/xml
Content-Length: 70

  • upload completely sent off: 70 out of 70 bytes
    < HTTP/1.1 500 Internal Server Error
    < Transfer-Encoding: chunked
    < Server: Jetty(6.1.8)
    <
    coverages : coverages* Connection #0 to host localhost left intact
  • Closing connection #0

Can anyone please tell me what I am doing wrong? How can I create a layer for this store using geoserver rest API?

Thanks!

Katie

Katie,
note that using ‘configure=all’ will automatically publish all the layer matching resources into the store.
Not sure about the error code 500, probably having geoserver logs may help understanding.
Cheers,
Carlo


Date: Thu, 13 Dec 2012 08:43:53 -0500
From: katieessadro@anonymised.com
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] trying to create a layer for a coveragestore using the rest API

Hello all,

I have created a coveragestore in geoserver using the rest API like this:

curl -u admin:geoserver -v -XPOST -H “Content-type: text/xml” –T C:\Users\katie\Desktop\pyramidstore.xml http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores?configure=all

My xml was this:

walkerpyramid

walkerpyramid test

ImagePyramid

true

walker

<__default>false</__default>

file:F:\gis\geotiffs\pyramid3

Next I wanted to create a layer for the coverage store, so I tried this:

curl -v -u admin:geoserver -XPOST -H “Content-type: text/xml” -d “walkerpyramid” http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/coverages

However, this gave me the following error:

  • About to connect() to localhost port 8080 (#0)
  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

POST /geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/coverages
HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1
Host: localhost:8080
Accept: /
Content-type: text/xml
Content-Length: 70

  • upload completely sent off: 70 out of 70 bytes
    < HTTP/1.1 500 Internal Server Error
    < Transfer-Encoding: chunked
    < Server: Jetty(6.1.8)
    <
    coverages : coverages* Connection #0 to host localhost left intact
  • Closing connection #0

Can anyone please tell me what I am doing wrong? How can I create a layer for this store using geoserver rest API?

Thanks!

Katie

------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hello Carlo,

So you are suggesting since I used configure=all that there should be a
layer created when I create the store? There is no layer that I can see.

Thanks,
Katie

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022755.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

You can try these:
curl -u admin:geoserver -v -XPOST -H "Content-Type: application/xml" -d
"<coverageStore><name>walkerpyramid</name><workspace>walker</workspace><enabled>true</enabled></coverageStore>"
http://localhost/geoserver/rest/workspaces/walker/coveragestores

curl -u admin:geoserver -v -XPUT -H "Content-type: text/plain"
-d"file:F:/gis/geotiffs/pyramid3"
http://localhost/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/external.imagepyramid

Worked with image mosaic but I haven't tried it with image pyramid.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022760.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

The second line gives me this error:

curl -u admin:geoserver -v -XPUT -H "Content-type: text/plain"
-d"file:F:/gis/geotiffs/pyramid3"
http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/external.imagepyramid

* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1... connected
* Server auth using Basic with user 'admin'

PUT
/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/external.im

agepyramid HTTP/1.1

Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1
Host: localhost:8080
Accept: */*
Content-type: text/plain
Content-Length: 29

* upload completely sent off: 29 out of 29 bytes
< HTTP/1.1 500 Internal Server Error
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)
<
* Connection #0 to host localhost left intact
* Closing connection #0

Any idea what could be wrong?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022761.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

The “500 Internal Server Error” message only tells us that an unexpected error occurred while trying to apply your changes. This is a bug since at the very least the error message should give you some information about how to correct the problem.

Unfortunately that’s pretty much all we can tell you without more information. If you review the GeoServer logs after the failed request, do you see anything interesting (ie, that appears relevant to your rest error)? You may need to increase the log level in the GeoServer Global Settings page and retry the request.

···

On Thu, Dec 13, 2012 at 9:57 AM, Katie Essadro <katieessadro@anonymised.com> wrote:

The second line gives me this error:

curl -u admin:geoserver -v -XPUT -H “Content-type: text/plain”
-d"file:F:/gis/geotiffs/pyramid3"

http://localhost:8080/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/external.imagepyramid

  • About to connect() to localhost port 8080 (#0)
  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

PUT
/geoserver/rest/workspaces/walker/coveragestores/walkerpyramid/external.im
agepyramid HTTP/1.1

Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1
Host: localhost:8080
Accept: /

Content-type: text/plain
Content-Length: 29

  • upload completely sent off: 29 out of 29 bytes

< HTTP/1.1 500 Internal Server Error
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)
<

  • Connection #0 to host localhost left intact
  • Closing connection #0

Any idea what could be wrong?


View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022761.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ok I found my error.. it was that the path F:\gis\geotiffs\pyramid3 did not
exist anymore. When I changed it to the correct path, it worked!! Finally!!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022765.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Ok, nevermind my 500 error, I got this to work!! The error was causing by the
F:\ path not existing anymore. When I made that a correct path, it worked!!!

Thank you SO MUCH!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/trying-to-create-a-layer-for-a-coveragestore-using-the-rest-API-tp5022742p5022766.html
Sent from the GeoServer - User mailing list archive at Nabble.com.