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>datastore_name</name>
  <description>dummy description</description>
  <type>PostGIS</type>
  <enabled>true</enabled>
  <connectionParameters>
    <entry key="Estimated extends">false</entry>
    <entry key="schema">venue</entry>
    <entry key="fetch size">1000</entry>
    <entry key="Max open prepared statements">50</entry>
    <entry key="Connection timeout">20</entry>
    <entry key="preparedStatements">false</entry>
    <entry key="database">mydbname</entry>
    <entry key="port">5432</entry>
    <entry key="min connections">1</entry>
    <entry key="dbtype">postgis</entry>
    <entry key="Loose bbox">true</entry>
    <entry key="host">localhost</entry>
    <entry key="max connections">10</entry>
    <entry key="user">foo</entry>
    <entry key="passwd">bar</entry>
    <entry key="create database">true</entry>
    <entry key="create database params">WITH TEMPLATE=mydbtemplate</entry>
  </connectionParameters>
  <__default>true</__default>
</dataStore>
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

Reply via email to