[DEPRECATED: Use PUT /manage/v2/servers/{id|name}/properties instead.]
Create or replace namespace bindings that can be used in subsequent query operations.
URL Parameters | |
---|---|
format? |
You can use this parameter as a fallback to the request Content-type
header. The Content-type header takes precedence
over format in most cases; for details, see
Controlling Input and Output Content Type in the REST Application Developer's Guide.
Accepted values: json or xml .
|
Request Headers | |
---|---|
Content-Type? |
The MIME type of the data in the request body, either
application/xml or application/json .
|
Upon success, MarkLogic Server responds with a status 204 (Content Updated). MarkLogic Server responds with a status 400 (Bad Request) if the request contains a bad binding.
rest-admin
role, or the
following privileges:
http://marklogic.com/xdmp/privileges/rest-admin
http://marklogic.com/xdmp/privileges/rest-writer
http://marklogic.com/xdmp/privileges/rest-reader
Use this request for creating or replacing bindings. All existing
bindings are replaced by the bindings in the request body. To add
new bindings without changing existing bindings, use the POST method.
To replace only one binding, use
PUT /v1/config/namespaces/{prefix}
.
For details, see Using Namespace Bindings in the REST Application Developer's Guide.
The content type can be specified using either the format
parameter or Content-type
header. One or the
other must be supplied. If both are supplied and are different,
the Content-type header takes precedence in most cases. For details, see
Controlling Input and Output Content Type in the REST Application Developer's Guide.
The request body must have the following format when sending XML:
<rapi:namespace-bindings xmlns="http://marklogic.com/rest-api"> <rapi:prefix>the-prefix</rapi:prefix> <rapi:uri>the-uri</rapi:uri> </rapi:namespace-bindings>
The request body must have the following format when sending JSON:
{"namespace-bindings": [ {"prefix" : "the-prefix", "uri" : "the-uri" }, ... ]}
$ cat ns-xml <namespace-bindings xmlns="http://marklogic.com/rest-api"> <namespace> <prefix>bill</prefix> <uri>http://marklogic.com/examples/shakespeare</uri> </namespace> </namespace-bindings> $ curl --anyauth --user user:password -X PUT -d@'./ns-xml' -i \ -H "Content-type: application/xml" \ http://localhost:8000/v1/config/namespaces ==> MarkLogic Server replaces any existing namespace bindings with the single binding between the prefix "bill" and the namespace URI "http://marklogic.com/examples/shakespeare. MarkLogic Server returns the following headers. Server: MarkLogic Content-Type: text/xml; charset=UTF-8 Content-Length: 211 Connection: close HTTP/1.1 204 Updated Location: Server: MarkLogic Content-Length: 0 Connection: close
$ cat ns-json { "namespace-bindings": [ { "prefix": "will", "uri": "http://marklogic.com/examples/shakespeare" } ] } $ curl --anyauth --user user:password -X PUT -d@'./ns-json' -i \ -H "Content-type: application/json" \ http://localhost:8000/v1/config/namespaces ==> MarkLogic Server replaces any existing namespace bindings with the single binding between the prefix "will" and the namespace URI "http://marklogic.com/examples/shakespeare. MarkLogic Server returns the following headers. Server: MarkLogic Content-Type: text/xml; charset=UTF-8 Content-Length: 211 Connection: close HTTP/1.1 204 Updated Location: Server: MarkLogic Content-Length: 0 Connection: close