https://authzed.com logo
#spicedb
Title
# spicedb
l

lixuan

05/17/2023, 6:55 AM
excuse me, i have a question, Isn't this interface (rpcReadRelationships) supposed to return a list? Why only one relationship, moreover , rpc WriteRelationships , How do I batch write? An error will appear:a relationship can only be specified in an update once per overall WriteRelation... (442 bytes)
v

vroldanbet

05/17/2023, 8:36 AM
👋🏻 -
ReadRelationships
is a gRPC Streaming API, you have to read from the stream to get the results, so you won't get a list - You can write transactionally multiple relationships.
WriteRelationships
allows you to do that, please have a look at the API specification in https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.WriteRelationships. That error suggests that, within the same
WriteRelationships
payload, you've specified the same relationship at least twice
l

lixuan

05/17/2023, 8:53 AM
thanks for your answer, but what i called is the http interface (/v1/relationships/read), but the result is a single data, can i get a list?
j

Joey

05/17/2023, 9:13 AM
because it is a streaming API, if invoked via REST, you will receive responses in JSON-L format (https://jsonlines.org/), with each result being its own line
there won't be an overall JSON response, because it is being streamed over time