API mapping for /api/library/layouts/{id}/permissions not really there?

Hello,

I’m trying to script some stuff up around layout permissions, and I was attempting to use the “Update Layout Permissions” PUT option listed in the API Documentation, instead of using the larger “Update a Layout” PUT which also includes some permissions settings.

I’m reading in the current Site ID values that have permissions just to compare, and that’s working fine, but when I feed my JSON back to the API endpoint listed in the documentation, /api/library/layouts/{id}/permissions I’m receiving an error of “WARN o.s.w.s.PageNotFound - No mapping for PUT /api/library/layouts/996/permissions”

For the info below, I was just reading in the current layout 996 Site ID permissions, appending the values to a JSON object, and then feeding that back to the API just to make sure things were going work, but I’m see:

{“success”:false,“msg”:“Unable to find api endpoint PUT /api/library/layouts/996/permissions”}
<bound method Response.json of <Response [404]>>

layout 996 perms: {‘instanceTypeLayout’: {‘permissions’: {‘resourcePermissions’: {‘sites’: [{‘id’: 2}, {‘id’: 10}, {‘id’: 13}, {‘id’: 7}, {‘id’: 9}, {‘id’: 8}]}}}}

Does the /api/library/layouts/{id}/permissions no longer exist or am I maybe missing some typo? This is in version 7.0.7 of Morpheus

Hi @rjr162, I hope your week is starting well!

I’ve verified that the endpoint of PUT is a typo in the API docs and it should be POST. Try your call using that instead and see what you get.

Alternatively, as you mentioned, you can use the same payload and call the Update a Layout endpoint as well and supply the permissions there too there. I used the same payload for both endpoints, so either should work.

Example payload I used:

{
  "instanceTypeLayout": {
    "permissions": {
      "resourcePermissions": {
        "sites": [
          {
            "id": 15
          }
        ],
        "all": false
      }
    }
  }
}

The docs will be updated and should be reflected in the next version.

Hope that helps!

1 Like

Awesome and thank you! I didn’t look that deep at the other API end point for the layout update, I just figured being a bigger “object” level it would require more.

Thanks again!