Question on updating networkGroup permissions via API

I’m reworking an old on-boarding script we have that uses calls to the morpheus-cli to a python based script that uses the API, but I’m hitting an issue with updating networkGroup permissions.

From what I can see by calling a get on a networkGroup, the permissions are laid out line the networks are:

This reads in fine, but the issue is when I do a PUT following that pattern I get a status_code 200 but the new group ID isn’t listed in the sites[ ] section of the returned JSON, ie> it never grants that new group permission to the networkGroup

When I do a morpheus-cli call with the --curl tag, it shows

-d '{
“networkGroup”: {
“foo”: “bar”
“resourcePermissions”: {
“sites”: [
with the “resourcePermissions” key outside of the “networkGroup” key.

My call is using:
{‘networkGroup’: {‘resourcePermission’: {‘sites’: [{‘id’: #}, {‘id’: #}, {‘id’: #}, {‘id’: ?}]}}}

Where # are the existing groupIds that have access to the networkGroup, and ? is the new groupId that I want to give access, and this is returing a status_code 200, no error, but the returned JSON shows that there’s been no adjustment to the permissions at all.
I tried setting up my payload like the morpheus-cli response (without the { “foo”: “bar” } but that just errors with a KeyError.

Any suggetions?

Hi rhr162,

endpoint url : /api/networks/groups/
Please use the below body.



1 Like

Hello, what version of Morpheus are you using and what version of the CLI are you using?

Believe sites should be an array of only the ID.

so { “networkGroup”: { “sites”: [1, 2, 3] } }

I did forget the version info, both are 6.2.3

The combo that finally ended up working as what vsenthilkarasu listed:

{‘networkGroup’: {‘name’: ‘’}, ‘resourcePermissions’: {‘sites’: [{‘id’: #}, {‘id’: #}, {‘id’: #}, {‘id’: #}, {‘id’: #}, {‘id’: #}, {‘id’: ?}]}}
Where the # was the old ID values already existing and the ? was my new ID. That returned the status_code 200, error none while also actually updating the groups who have access to the networkGroup.

There’s a few areas where the API docs show just the array, but morpheus-cli --curl shows doing the sites: [ {id: 1}, {id: 2}, etc]

which works, so I assume it’s handling it either way where the sites provided only the array ID reads it in as just that, but you can also specify it out

One thing to note is the differences in what’s listed in the API docs:

The updatenetwork lists a lot more parameter values that are available, which is where doing the morpheus-cli --curl helped out a lot in attempting to fill the gaps