Hi, when talking directly to the Cerbos gRPC servi...
# community
v
Hi, when talking directly to the Cerbos gRPC service, how do I represent the attributes for a principal and for a resource in JSON? I need this for testing the gRPC in Postman and K6. Trying to do similar to this example in the playground https://play.cerbos.dev/p/LXjgi62fb63c1QypYuZhsyRK3cTMcRx5 This is what I have but it does not work.
{
"requestId": "123123",
"version": "default",
"principal": {
"id": "<mailto:email@email.com|email@email.com>",
"roles": [
"user"
],
"attr": [
{
"key":"salesreps",
"value": {
"kind": {
"listValue": ["1","2"]
}
}
}
]
},
"resources": [
{
"resource": {
"kind": "customer",
"version": "default",
"id": "12345",
"scope": "teamb",
"attr": [
{
"key":"salesrep",
"value": {
"kind": {
"stringValue": "2"
}
}
}
]
},
"actions": ["VIEW"]
}
]
}
a
The attrbuite field should just be a map eg
Copy code
"principal": {
    "id": "alice",
    "roles": ["employee"],
    "attr": {
      "department": "accounting",
      "geography": "GB",
      "team": "design"
    }
  },
v
ok let me try grpcurl, it could be a postman issue but it doesn't like it when I did this. It expects the attr to be an array.
a
Odd - let me us know how you get on
v
will do
a
The protobuf type is
map<string, google.protobuf.Value>
v
grpc curl works, must be how postman did reflection on the grpc end point.