Before you start
- Node.js
- Go
- .NET
- Python
- Java
- curl
- Deploy an instance of the OpenFGA server, and have ready the values for your setup: FGA_STORE_ID, FGA_API_URL and, if needed, FGA_API_TOKEN.
- You have installed the SDK.
- You have configured the authorization model and added some relationship tuples.
- You have loaded
FGA_STORE_IDandFGA_API_URLas environment variables.
Step by step
To get a chronologically ordered list of tuples that have been written or deleted in your store, you can do so by calling the Read Changes API.01. Configure The OpenFGA API Client
First you will need to configure the API client.- Node.js
- Go
- .NET
- Python
- Java
- curl
02. Get changes for all object types
To get a paginated list of changes that happened in your store:- Node.js
- Go
- .NET
- Python
- Java
- CLI
- curl
write or delete), and the timestamp in which that operation took place. The result will also contain a continuation token. Save the continuation token in persistent storage between calls so that it is not lost and you do not have to restart from scratch on system restart or on error.
You can then use this token to get the next set of changes:
- Node.js
- Go
- .NET
- Python
- Java
- CLI
- curl
- The default page size is 50. The maximum page size allowed is 100.
- The API response does not expand the tuples. If you wrote a tuple that includes a userset, like
{"user": "group:abc#member", "relation": "owner": "doc:budget"}, the Read Changes API will return that exact tuple.
03. Get changes for a specific object type
Imagine you have the following authorization model: It is possible to get a list of changes that happened in your store that relate only to one specific object type, likefolder, by issuing a call like this:
- Node.js
- Go
- .NET
- Python
- Java
- CLI
- curl
type. (If you send this continuation token without the type parameter set, you will get an error).
- Node.js
- Go
- .NET
- Python
- Java
- CLI
- curl