https://cerbos.dev logo
#community
Title
# community
f

Farzad Soltani

08/08/2023, 8:13 AM
I have a small question about the docs in this link: https://docs.cerbos.dev/cerbos/latest/tutorial/03_calling-cerbos There is a section which claims to use this JSON as the payload for the
/api/check
endpoint:
Copy code
{
  "principal": {
    "id": "user_1",     // the user ID
    "roles": ["user"],  // list of roles from user's profile
    "attr": {}          // a map of attributes about the user - not used yet
  },
  "resource": {
    "kind": "contact",  // the type of the resources
    "instances": {      // a map of the resource instance(s) being checked
        "contact_1": {  // key is the ID of the resource instance
            "attr": {}  // a map of attributes about the resource - not used yet
        }
    }
  },
  "actions": ["read"]   // the list of actions to be done on the resource
}
This is pointing users to the deprecated version of the endpoint and doesn't work with the new endpoint. An example of a valid payload would be something like this:
Copy code
{
  "principal": {
    "id": "user_1",
    "roles": [
      "user"
    ],
    "attr": {}
  },
  "resources": [
    {
      "actions": [
        "read",
        "write"
      ],
      "resource": {
        "id": "XX125",
        "kind": "contact"
      }
    }
  ]
}
If my point is valid, I can open an issue and PR to fix this section.
o

oguzhan

08/08/2023, 8:52 AM
Hey, yes it’s valid.
5 Views