Loading TOC...

POST /manage/v2/query-rolesets

Summary

This resource endpoint creates a new query roleset using a name or id passed in a payload.

Request Headers
Accept The expected MIME type of the request body. If the format parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the request body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.
Response Headers
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.

Response

A successful call to the endpoint will return 201 (Created), resulting in the creation of new query rolesets. A response code of 400 (Bad Request) indicates either the query rolesets already exist, or 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/xmlXML Content
application/jsonJSON Content
Produces
application/jsonJSON Content
application/xmlXML Content

Required Privileges

This operation requires the manage-admin role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage

Usage Notes

This request accepts a payload with the following structure.

query-roleset

A query roleset definition

This is a complex structure with the following children:

role-id

A role identifier (unique key).

role-name

The role-name.

Example

> curl -X POST --anyauth -u admin:admin 
            -d @file.xml -H "Content-Type:application/xml"  http://localhost:8002/manage/v2/query-rolesets
            

Payload (as file.xml):

<?xml version="1.0" encoding="UTF-8"?>
<query-roleset-default-list xsi:schemaLocation="http://marklogic.com/manage/security manage-security.xsd" xmlns="http://marklogic.com/manage/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <meta>
    <uri>/manage/v2/query-rolesets</uri>
    <current-time>2017-05-02T02:05:22.3371423-07:00</current-time>
    <elapsed-time units="sec">0.012981</elapsed-time>
  </meta>
  <list-items>
    <list-count units="quantity">0</list-count>
  </list-items>
  <relations>
    <relation-group array="true">
      <typeref>security-database</typeref>
      <relation-count units="quantity">1</relation-count>
      <relation array="true">
	<uriref>/manage/v2/databases/Security</uriref>
	<roleref>database</roleref>
	<idref>7161534863501463199</idref>
      </relation>
    </relation-group>
  </relations>
</query-roleset-default-list>

This is the payload for POST as XML. The call does not return any content, beyond headers.

Example

> curl -X POST --anyauth -u admin:admin 
            -d @file.json -H "Content-Type:application/json"  http://localhost:8002/manage/v2/query-rolesets
            

Payload (as file.json):

	{
		"query-roleset-default-list":{
			"meta":{
				"uri":"/manage/v2/query-rolesets",
				"current-time":"2017-05-02T02:05:22.3396027-07:00",
				"elapsed-time":{
					"units":"sec",
					"value":0.0114557}
				}
			,
			"list-items":{
				"list-count":{
					"units":"quantity",
					"value":0}
				}
			,
			"relations":{
				"relation-group":{
					"typeref":"security-database",
					"relation-count":{
						"units":"quantity",
						"value":1}
					,
					"relation":{
						"uriref":"/manage/v2/databases/Security",
						"roleref":"database",
						"idref":"7161534863501463199",
						"nameref":"Security"}
					}
				}
			,
			"related-views":{
				"related-view":[
					{
						"view-type":"root",
						"view-name":"default",
						"view-uri":"/manage/v2"}
					]
				}
			}
		}
  

This is the payload for POST as JSON. The call does not return any content, beyond headers.

Comments

  • This also requires the 'security' role. Without this role, a 403 Forbidden error is returned.
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy