Re: [Geoserver-users] Geoserver+postgis: how to complete creating database via REST API?

2018-07-13 Thread Andrea Aime
Hi,
my guess is that the REST API is making no attempt at using the store, and
thus, does not create an instance
of it (which is what makes the factory create the store and the actual
database as a side effect).
Thinking out loud, can you try listing the feature types in the store, with
the list=all, which should make it list
all the available tables, thus forcing it to connect?

See also:
http://docs.geoserver.org/latest/en/api/#/1.0.0/featuretypes.yaml

Cheers
Andrea


On Wed, Jul 11, 2018 at 5:41 PM, Miodrag Vidanovic <
miodrag.vidano...@heidelberg-mobil.com> wrote:

> Hi everyone!
>
> I'm using geoserver 2.13.1 with postgres 9.5 and postgis 2.4.2.
>
> I am trying to use REST api to create workspace (works) and in it a
> datastore of postgis type. I have already prepared a template database in
> postgres and trying to use it here (this is the xml body of the post
> request to /geoserver/rest/workspaces/workspace_name/datastores):
>
> 
>
>   datastore_name
>
>   dummy description
>
>   PostGIS
>
>   true
>
>   
>
> false
>
> venue
>
> 1000
>
> 50
>
> 20
>
> false
>
> mydbname
>
> 5432
>
> 1
>
> postgis
>
> true
>
> localhost
>
> 10
>
> foo
>
> bar
>
> true
>
> WITH TEMPLATE=mydbtemplate
>
>   
>
>   <__default>true
>
> 
>
> The geoserver datastore is created as expected (and I'm getting 201 http
> code back), but the database itself is not created. No error messages. Only
> if I open that store now via geoserver web interface and click on the save
> button (without changing anything), only then is the database really
> created using desired template. So, all those params are correct, but there
> is something missing on the server side, like a commit or something, that
> would trigger the create db job.
>
> I have tried:
>
>- sending /reset and /reload requests afterwards - no db created
>- changing workspace and datastore properties with put request to
>trigger datastore saving somehow - changes are accepted, but no db created
>- I even tried sql injection by putting commit in that create database
>params entry after "with template" statement - also no error and no db
>created
>
> I don't see any other REST API function looking even remotely related to
> "apply changes". So, how can I achieve that via REST API?
>
>
>
> Cheers,
>
>   Mickey
>
>
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> 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
>
>


-- 

Regards, Andrea Aime == GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime
@geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054
Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339
8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it
--- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Geoserver-users mailing list

Please make sure you read the 

Re: [Geoserver-users] Geoserver+postgis: how to complete creating database via REST API?

2018-07-13 Thread Steve Omondi
Hi Miodrag,

I have a related issue but in my case I'm creating datastores of already
existing postgis databases both Postgis and Postgis (JNDI).
*My Steps*
I create the workspaces via REST and its okay.

Then when I create ImagePyramids stores via REST again in the above
workspace it works perfectly. Publishing Coverage Layers via REST is great
as well.

Creating  Postgis and Postgis (JNDI) datastores also works perfect via REST.

*However, the problem comes when I try to publish FeatureType Layers via
REST again of the datastores created above. I't doesn't work and the log
point to namespace related issues.*

My solution to this was like your case where I had to go to the
WorkspaceEditPage in Admin UI and click save to resolve the association
between Workspaces and their Namespaces.

I did ask about this on this forum but I haven't received any responses on
what could be the issue. I hope someone with more insights on geoserver
Catalog Configuration could shade some light.

Kind regards,
Steve Omondi


On Wed, Jul 11, 2018 at 9:23 PM Miodrag Vidanovic <
miodrag.vidano...@heidelberg-mobil.com> wrote:

> Hi everyone!
>
> I'm using geoserver 2.13.1 with postgres 9.5 and postgis 2.4.2.
>
> I am trying to use REST api to create workspace (works) and in it a
> datastore of postgis type. I have already prepared a template database in
> postgres and trying to use it here (this is the xml body of the post
> request to /geoserver/rest/workspaces/workspace_name/datastores):
>
> 
>
>   datastore_name
>
>   dummy description
>
>   PostGIS
>
>   true
>
>   
>
> false
>
> venue
>
> 1000
>
> 50
>
> 20
>
> false
>
> mydbname
>
> 5432
>
> 1
>
> postgis
>
> true
>
> localhost
>
> 10
>
> foo
>
> bar
>
> true
>
> WITH TEMPLATE=mydbtemplate
>
>   
>
>   <__default>true
>
> 
>
> The geoserver datastore is created as expected (and I'm getting 201 http
> code back), but the database itself is not created. No error messages. Only
> if I open that store now via geoserver web interface and click on the save
> button (without changing anything), only then is the database really
> created using desired template. So, all those params are correct, but there
> is something missing on the server side, like a commit or something, that
> would trigger the create db job.
>
> I have tried:
>
>- sending /reset and /reload requests afterwards - no db created
>- changing workspace and datastore properties with put request to
>trigger datastore saving somehow - changes are accepted, but no db created
>- I even tried sql injection by putting commit in that create database
>params entry after "with template" statement - also no error and no db
>created
>
> I don't see any other REST API function looking even remotely related to
> "apply changes". So, how can I achieve that via REST API?
>
>
>
> Cheers,
>
>   Mickey
>
>
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> 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
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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


[Geoserver-users] Geoserver+postgis: how to complete creating database via REST API?

2018-07-11 Thread Miodrag Vidanovic
Hi everyone!
I'm using geoserver 2.13.1 with postgres 9.5 and postgis 2.4.2.
I am trying to use REST api to create workspace (works) and in it a datastore 
of postgis type. I have already prepared a template database in postgres and 
trying to use it here (this is the xml body of the post request to 
/geoserver/rest/workspaces/workspace_name/datastores):

  datastore_name
  dummy description
  PostGIS
  true
  
false
venue
1000
50
20
false
mydbname
5432
1
postgis
true
localhost
10
foo
bar
true
WITH TEMPLATE=mydbtemplate
  
  <__default>true

The geoserver datastore is created as expected (and I'm getting 201 http code 
back), but the database itself is not created. No error messages. Only if I 
open that store now via geoserver web interface and click on the save button 
(without changing anything), only then is the database really created using 
desired template. So, all those params are correct, but there is something 
missing on the server side, like a commit or something, that would trigger the 
create db job.
I have tried:

  *   sending /reset and /reload requests afterwards - no db created
  *   changing workspace and datastore properties with put request to trigger 
datastore saving somehow - changes are accepted, but no db created
  *   I even tried sql injection by putting commit in that create database 
params entry after "with template" statement - also no error and no db created
I don't see any other REST API function looking even remotely related to "apply 
changes". So, how can I achieve that via REST API?

Cheers,
  Mickey


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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