I did it with CURL using the test data shipped with GeoServer, please find a attached my example.
Maybe this issue was fixed in GeoServer 12.x (master), give it a try.

On 04/13/2017 09:13 PM, dimmihel wrote:
Hi Nuno,

Thanks for giving this a go; it is frustrating that I am not able to use the
underscore in feature type creation in my Geoserver versions.

Are you suggesting an issue with the python requests module? I doubt it
because I am able to use the same module (i.e requests) using HTML POST to
create workspaces, and datastores which include underscores in their names
with no problems.

By the way I am receiving a 400 code and not 401; typo error which I edited.

Can you please share the code which you used?

Regards,
D.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Create-layer-REST-API-issues-tp5317197p5317272.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:   +39 0584 1660272
mob:   +39  333 8128928

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i 
file/s allegato/i sono
da considerarsi strettamente riservate. Il loro utilizzo è consentito 
esclusivamente al destinatario del messaggio, per le finalità indicate
nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il 
destinatario, Vi preghiamo cortesemente di darcene notizia via e
-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal 
Vostro sistema. Conservare il messaggio stesso, divulgarlo
anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per 
finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of
the named addressee(s) and may be confidential or proprietary in nature or 
covered by the provisions of privacy act (Legislative Decree
June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord 
with its purpose, any disclosure, reproduction, copying,
distribution, or either dissemination, either whole or partial, is strictly 
forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact immediately 
the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender does 
not give any warranty or accept liability as the content,
accuracy or completeness of sent messages and accepts no responsibility  for 
changes made after they were sent or for other risks which
arise as a result of e-mail transmission, viruses, etc.

curl --request POST \
  --url 
http://localhost:8080/geoserver/rest/workspaces/tiger/datastores/nyc/featuretypes
 \
  --header 'authorization: Basic YWRtaW46Z2Vvc2VydmVy' \
  --header 'content-type: application/xml' \
  --data '<featureType>
  <name>pub_roads</name>
  <nativeName>giant_polygon_2</nativeName>
  <namespace>
    <name>tiger</name>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate" 
href="http://localhost:8075/geoserver/rest/namespaces/tiger.xml"; 
type="application/xml"/>
  </namespace>
  <title>World rectangle</title>
  <abstract>A simple rectangular polygon covering most of the world, it&apos;s 
only used for the purpose of providing a background (WMS bgcolor could be used 
instead)</abstract>
  <keywords>
    <string>DS_giant_polygon</string>
    <string>giant_polygon</string>
  </keywords>
  <nativeCRS>GEOGCS[&quot;GCS_WGS_1984&quot;, 
  DATUM[&quot;WGS_1984&quot;, 
    SPHEROID[&quot;WGS_1984&quot;, 6378137.0, 298.257223563]], 
  PRIMEM[&quot;Greenwich&quot;, 0.0], 
  UNIT[&quot;degree&quot;, 0.017453292519943295], 
  AXIS[&quot;Longitude&quot;, EAST], 
  AXIS[&quot;Latitude&quot;, NORTH]]</nativeCRS>
  <srs>EPSG:4326</srs>
  <nativeBoundingBox>
    <minx>-180.0</minx>
    <maxx>180.0</maxx>
    <miny>-90.0</miny>
    <maxy>90.0</maxy>
    <crs>EPSG:4326</crs>
  </nativeBoundingBox>
  <latLonBoundingBox>
    <minx>-180.0</minx>
    <maxx>180.0</maxx>
    <miny>-90.0</miny>
    <maxy>90.0</maxy>
    <crs>EPSG:4326</crs>
  </latLonBoundingBox>
  <projectionPolicy>FORCE_DECLARED</projectionPolicy>
  <enabled>true</enabled>
  <metadata>
    <entry key="kml.regionateFeatureLimit">10</entry>
    <entry key="cacheAgeMax">3600</entry>
    <entry key="cachingEnabled">true</entry>
    <entry key="indexingEnabled">false</entry>
    <entry key="dirName">DS_giant_polygon_giant_polygon</entry>
  </metadata>
  <store class="dataStore">
    <name>tiger:nyc</name>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate" 
href="http://localhost:8075/geoserver/rest/workspaces/tiger/datastores/nyc.xml"; 
type="application/xml"/>
  </store>
  <maxFeatures>0</maxFeatures>
  <numDecimals>0</numDecimals>
  <overridingServiceSRS>false</overridingServiceSRS>
  <skipNumberMatched>false</skipNumberMatched>
  <circularArcPresent>false</circularArcPresent>
  <attributes>
    <attribute>
      <name>the_geom</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>com.vividsolutions.jts.geom.MultiPolygon</binding>
    </attribute>
  </attributes>
</featureType>'
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to