Adding SQL views via REST fails with JSON payload

Description

Creating a SQL view-based layer via REST with the following request:

curl -i --user admin:geoserver -X POST -H 'Content-Type: application/json; charset=utf-8' -d @test_post.json
'http://localhost:{port}/geoserver/rest/workspaces/{test_workspace}/datastores/{test_store}/featuretypes'

according to the documentation for Post-request and SQL views

and the content of test_post.json as following:

returns HTTP/1.1 500 server error
Schema 'test_post' does not exist
Noticed : omitting the "name" attribute from featureType turns the error into Schema 'null' does not exist

This works fine with XML, using the same with test_post.xml
curl -i --user admin:geoserver -X POST -H 'Content-Type: text/xml; charset=utf-8' -d @test_post.xml
'http://localhost:{port}/geoserver/rest/workspaces/{test_workspace}/datastores/{test_store}/featuretypes'

test_post.xml :

--> HTTP/1.1 201 Created

Environment

None

Status

Assignee

Unassigned

Reporter

Fadi

Triage

Fix versions

None

Affects versions

Priority

Medium
Configure