[Geoserver-users] Geoserver create coverage via rest api

Hello list,

I must be overlooking something simple. I am using the REST API to create a Geoserver coveragestore and coverage. I followed the example and successfully created the store. However, when I go to the web interface I find that I didn’t publish/create the image mosaic jdbc store.

This is the code snippet that I am using in python
payload = f.read()
headers = {‘Content-type’:‘text/xml’}
resp = requests.post(workspace_url, auth=(user,word), data=payload, headers=headers)

I tried posting to an xml to this url “/workspaces//coveragestores//coverages/” and received a 401 error.
I am overlooking something, but I am not sure what. According to this url (http://docs.geoserver.org/stable/en/user/rest/api/coveragestores.html). The coverage should be created automatically. " The coverageName parameter specifies the name of the coverage within the coverage store. This parameter is only relevant if the configure parameter is not equal to “none”. If not specified the resulting coverage will receive the same name as its containing coverage store. "

However, I do not have a new layer in geoserver. It is possible for me to go through the web interface and add the layer, but I would prefer to automate if possible.

···

David Haynes, Ph.D.
Research Associate Terra Populus
Minnesota Population Center
612-626-3933
www.terrapop.org

On Tue, 17 Nov 2015 04:34:05 PM David Haynes II wrote:

I tried posting to an xml to this url
"/workspaces/<ws>/coveragestores/<cs>/coverages/<c>" and received a 401
error.

Can you say what you are really posting? What are <ws>, <cs> and <c> here?
Also, can you confirm that that isn't the full URL (i.e. you really did put a
machine name and protocol to the URL)?

What is the data type you are trying to upload?

What user are you trying to upload as?

Brad

Hi Brad,

Hope this helps clear things up

/workspaces//coveragestores//coverages/

workspacename = GLI_CEREAL
coveragestore = BARLEYHAR
coverage = BARLEYHAR

I successfully created a image mosaic jdb coveragestore by posting an xml at url1url1: http://geoserver.terrapop.org/geoserver/rest/workspaces/GLI_CEREAL/coveragestores/

This resulted in a successful coveragestore at the following address, url2. However, no coverage/layer was automatically published from this coveragestore. So I am looking for an example of creating the coverage from the coveragestore I believe.
url2: http://geoserver.terrapop.org/geoserver/rest/workspaces/GLI_CEREAL/coveragestores/BARLEYHAR

Also, I tried posting a coverage.xml to this new url and received a 403 error

http://geoserver.terrapop.org/geoserver/rest/workspaces/GLI_CEREAL/coveragestores/BARLEYHAR/coverages

···

On Tue, Nov 17, 2015 at 11:01 PM, Brad Hards <bradh@anonymised.com> wrote:

On Tue, 17 Nov 2015 04:34:05 PM David Haynes II wrote:

I tried posting to an xml to this url
“/workspaces//coveragestores//coverages/” and received a 401
error.
Can you say what you are really posting? What are , and here?
Also, can you confirm that that isn’t the full URL (i.e. you really did put a
machine name and protocol to the URL)?

What is the data type you are trying to upload?

What user are you trying to upload as?

Brad



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

David Haynes, Ph.D.
Research Associate Terra Populus
Minnesota Population Center
612-626-3933
www.terrapop.org

On Wed, 18 Nov 2015 08:26:50 AM David Haynes II wrote:

> What is the data type you are trying to upload?
>
> What user are you trying to upload as?

Please provide all the information requested. Its easier to help you if you
help us...

Brad

I found a solution. It had to do with the data being uploaded not the url.

···

On Tue, Nov 17, 2015 at 11:01 PM, Brad Hards <bradh@anonymised.com> wrote:

On Tue, 17 Nov 2015 04:34:05 PM David Haynes II wrote:

I tried posting to an xml to this url
“/workspaces//coveragestores//coverages/” and received a 401
error.
Can you say what you are really posting? What are , and here?
Also, can you confirm that that isn’t the full URL (i.e. you really did put a
machine name and protocol to the URL)?

What is the data type you are trying to upload?

What user are you trying to upload as?

Brad



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

David Haynes, Ph.D.
Research Associate Terra Populus
Minnesota Population Center
612-626-3933
www.terrapop.org