api
api copied to clipboard
Is it possible to provide an interface for batch checking, e.g. BatchCheck?
Hey @caozongkai1008 - the API does not support BatchCheck at the moment, however all our supported SDKs do.
For example, in the JS SDK: https://github.com/openfga/js-sdk#batch-check
const options = {
// if you'd like to override the authorization model id for this request
authorizationModelId: "01GXSA8YR785C4FYS3C0RTG7B1",
}
const { responses } = await fgaClient.batchCheck([{
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "viewer",
object: "document:budget",
}, {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "member",
object: "document:budget",
}, {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "viewer",
object: "document:roadmap",
contextual_tuples: [{
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "writer",
object: "document:roadmap"
}],
}], options);
/*
responses = [{
allowed: false,
_request: {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "viewer",
object: "document:budget",
}
}, {
allowed: false,
_request: {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "member",
object: "document:budget",
},
err: <FgaError ...>
}, {
allowed: true,
_request: {
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "viewer",
object: "document:roadmap",
contextual_tuples: [{
user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation: "writer",
object: "document:roadmap"
}],
}},
]
*/
Take a look and let us know what you think!
Thanks. I know sdk supports it.
Can you give us your feedback on that interface? We add some features to the SDKs before the API to gather feedback for folks in order to iterate quicker and stabilize on an interface that works for everyone.
Any thoughts on the one in the SDKs? Anything you would like changed in that?
thanks, we use OpenFGA for access control (through GRPC), and the usage scenario involves batch check, so it would be great if there is such an interface.