Build Information:
Version 2.1.4
Subversion Revision 17150
Build Date 01-Jun-2012 17:02
GeoTools Version 2.7.5 (rev 38793)
I've been trying to use the GeoServer REST API through curl, based on the
examples in the documentation
(http://docs.geoserver.org/2.1.x/en/user/restconfig/rest-config-examples/rest-config-examples-curl.html).
My desired application is to create new "coveragestores" through the API; a
specific example of this was not available in the documentation.
My initial data_dir/security/rest.properties configuration was as follows:
/**;GET=ROLE_ADMINISTRATOR
/**;POST,DELETE,PUT=ROLE_ADMINISTRATOR
I authenticated my curl requests, however, they were rejected 405 Method Not
Allowed (example follows). I changed the configuration and tried again:
/**GET,POST=IS_AUTHENTICATED_ANONYMOUSLY
/**PUT,DELETE=ROLE_ADMINISTRATOR
First with a JSON payload (tried both authenticated, as shown here with fake
credentials, and anonymous):
curl -u user:password -v -XPOST -H 'Content-type: text/json' -d '{
"name": "test_name",
"type": "GeoTIFF",
"workspace": {
"name": "GLOS_AOCs",
"href":
"http:\/\/localhost:8080\/geoserver\/rest\/workspaces\/GLOS_AOCs.json"
},
"url":
"file://J:\\gis_lab\\project\\GLOS_Tribs_AOC\\Data\\St_Louis_River\\MODIS_TSSI\\TSSI_final\\Masked_20120414A20121_TSSIG.tif",
}' http://localhost:8080/geoserver/rest
* About to connect() to localhost port 8080 (#0)
* Trying 128.0.0.1... connected
* Server auth using Basic with user 'username'
> POST /geoserver/rest HTTP/1.1
> Authorization: Basic Z2lzYWRtOmZpcm85NjMh
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1
> zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
> Content-type: text/json
> Content-Length: 344
>
* upload completely sent off: 344out of 344 bytes
< HTTP/1.1 405 Method Not Allowed
< Allow: GET
< Date: Wed, 29 Aug 2012 13:36:08 GMT
< Server: Noelios-Restlet-Engine/1.0..8
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0
Then again with XML (tried both authenticated and anonymous, as shown here):
curl -v -XPOST -H 'Content-type: text/xml' -d '
<coverageStore>
<name>Test</name>
<type>GeoTIFF</type>
<enabled>true</enabled>
<workspace>
<name>GLOS_AOCs</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
href="http://localhost:8080/geoserver/rest/workspaces/GLOS_AOCs.xml"
type="application/xml"/>
</workspace>
<__default>false</__default>
<url>file://J:\project\GLOS_Tribs_AOC\Data\Maumee_River\MODIS_TSSI\TSSI_final\Masked_A2012144190000_TSSIG.tif</url>
<coverages>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
href="http://localhost:8080/geoserver/rest/workspaces/GLOS_AOCs/coveragestores/Maumee_TSSI_20120524/coverages.xml"
type="application/xml"/>
</coverages>
</coverageStore>' http://localhost:8080/geoserver/rest
Still received 405 Method Not Allowed. Any advice is appreciated.
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/REST-API-security-in-2-1-4-received-405-Method-Not-Allowed-via-curl-tp4998890.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users