Hi Jim, Thank you. Yes indeed, the following works, as you said:
"permission": [ { "role-name": "reader", "capability": "read" }, { "role-name": "writer", "capability": "read" }, { "role-name": "writer", "capability": "update" } ] This is for the Management API. But the Client API needs the following different format for the metadata of a multipart load (see?, "permissions", "capabilities", and same role only once with several capabilities): "permissions": [ { "role-name": "reader", "capabilities": ["read"] }, { "role-name": "writer", "capabilities": ["read", "update"] } ] Very unfortunate, as it is then not possible to factorize out their handling in code that needs to access both APIs. But anyway, at least now I know where the error was :-) Regards, -- Florent Georges H2O Consulting http://h2o.consulting/ On 28 November 2017 at 06:19, Jim Fuller wrote: > in json array names are singular eg. permissions should be > > "permission": > [ { "role-name": "reader", "capability": "read" }, > { "role-name": "writer", "capability": "read" }, > { "role-name": "writer", "capability": "update" } ] > ________________________________________ > From: general-boun...@developer.marklogic.com <general-bounces@developer. > marklogic.com> on behalf of Florent Georges <li...@fgeorges.org> > Sent: 28 November 2017 00:15:18 > To: MarkLogic Developer Discussion > Subject: [MarkLogic Dev General] Management API: 400 on creating a role > with permissions > > Hi, > > I send a POST to /manage/v2/roles with the following content: > > { "role-name": "writer", > "description": "Test role 2.", > "permissions": > [ { "role-name": "reader", "capability": "read" }, > { "role-name": "writer", "capability": "read" }, > { "role-name": "writer", "capability": "update" } ] } > > But I receive a 400 back with the following content: > > MANAGE-INVALIDPAYLOAD: (err:FOER0000) Payload has errors in > structure, content-type or values. Unexpected element: role-name > (not in schema) > > The following request succeeds (with no permissions property): > > { "role-name": "reader", > "description": "Test role 1." } > > Did I miss something in https://docs.marklogic.com/ > REST/POST/manage/v2/roles? > > Regards, > > -- > Florent Georges > H2O Consulting > http://h2o.consulting/ > > > _______________________________________________ > General mailing list > General@developer.marklogic.com > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general >
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general