After much searching I haven't found a working example of posting JSON to the
REST API. The documentation insists entities can be created using XML or
JSON but all examples are in XML.

I've included my attempts so far at creating a new workspace and their
responses. If anyone can point out where I'm going wrong I'd be extremely
grateful!

curl -u admin:geoserver -v -XPOST -H 'Content-type: application/json' -d
'{"name":"test_workspace","href":"www.test.com"}'
http://localhost:8080/geoserver/rest/workspaces
# Status: 500, Message: "name : name"

curl -u admin:geoserver -v -XPOST -H 'Content-type: application/json' -d
'{"workspace":{"name":"test_workspace","href":"www.test.com"}}'
http://localhost:8080/geoserver/rest/workspaces
# Status: 500, Message: "-------------------------------"

curl -u admin:geoserver -v -XPOST -H 'Content-type: application/json' -d
'{"workspace":[{"name":"test_workspace","href":"www.test.com"}]}'
http://localhost:8080/geoserver/rest/workspaces
# Status: 500, Message: ":workspace name must not be null"

--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Unable-to-create-workspace-via-REST-posting-JSON-tp4982817.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

Reply via email to