This resource endpoint creates a new protected path using a name or id passed in a payload.
A successful call to the endpoint will return the HTTP code 201 (Created). The request has been fulfilled, resulting in the creation of a new resource. A status code of 400 (Bad Request) indicates that a protected path already exists, or that the payload is malformed. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges for this action.
Consumes | |
---|---|
application/xml | XML Content |
application/json | JSON Content |
Produces | |
---|---|
application/json | JSON Content |
application/xml | XML Content |
manage-admin
and security
rolehttp://marklogic.com/xdmp/privileges/manage
http://marklogic.com/xdmp/privileges/manage-admin
http://marklogic.com/xdmp/privileges/protect-path
This resource endpoint creates a new protected path using a name or id passed in a payload.
A "path-expression" is required.
Payload must be valid according to the schema type protected-path-properties
in the manage-protected-path-properties.xsd
schema. JSON payloads are internally converted to XML before validation.
The structure of the output returned from this REST API is as follows:
path-id
path-expression
path-namespaces
This is a complex structure with the following children:
path-namespace
This is a complex structure with the following children:
prefix
namespace-uri
permissions
This is a complex structure with the following children:
permission
This is a complex structure with the following children:
role-id
role-name
capability
path-set
> curl -X POST --anyauth -u admin:admin -d @file.xml -H "Content-Type:application/xml" http://localhost:8002/manage/v2/protected-paths
Payload (as file.xml):
<protected-path-properties xmlns="http://marklogic.com/manage/protected-path/properties"> <path-expression>//d</path-expression> <path-namespaces/> <permissions> <permission> <role-name>manage-user</role-name> <capability>read</capability> </permission> </permissions> </protected-path-properties>
This is the payload for POST as XML. The call does not return any content, beyond headers.
> curl -X POST --anyauth -u admin:admin \ -d @file.json -H "Content-Type:application/json" \ http://localhost:8002/manage/v2/protected-paths
Payload (as file.json):
{ "path-expression": "//e", "path-namespace": [], "permission": [{ "role-name": ["manage-user"], "capability": "read" }] }
This is the payload for POST as JSON. The call does not return any content, beyond headers