title | sidebar_position | slug | description |
---|---|---|---|
Update Relationship Tuples |
3 |
/getting-started/update-tuples |
Updating system state by writing and deleting relationship tuples |
import { DocumentationNotice, RelatedSection, SdkSetupHeader, SupportedLanguage, languageLabelMap, ProductConcept, ProductName, ProductNameFormat, WriteRequestViewer, SdkSetupPrerequisite, } from '@components/Docs'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This section will illustrate how to update .
- You have installed the SDK.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_SERVER_URL
as environment variables.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
Assume that you want to add user user:anne
to have relationship reader
with object document:Z
{
user: 'user:anne',
relation: 'reader',
object: 'document:Z',
}
Before calling the write API, you will need to configure the API client.
To obtain the access token:
To add the relationship tuples, we can invoke the write API.
<WriteRequestViewer relationshipTuples={[ { user: 'user:anne', relation: 'reader', object: 'document:Z', }, ]} skipSetup={true} allowedLanguages={[ SupportedLanguage.JS_SDK, SupportedLanguage.GO_SDK, SupportedLanguage.DOTNET_SDK, SupportedLanguage.PYTHON_SDK, SupportedLanguage.JAVA_SDK, SupportedLanguage.CLI, SupportedLanguage.CURL, ]} />
To delete relationship tuples, we can invoke the write API.
Assume that you want to delete user user:anne
's reader
relationship with object document:Z
{
user: 'user:anne',
relation: 'reader',
object: 'document:Z',
}
<WriteRequestViewer deleteRelationshipTuples={[ { user: 'user:anne', relation: 'reader', object: 'document:Z', }, ]} skipSetup={true} allowedLanguages={[ SupportedLanguage.JS_SDK, SupportedLanguage.GO_SDK, SupportedLanguage.DOTNET_SDK, SupportedLanguage.PYTHON_SDK, SupportedLanguage.JAVA_SDK, SupportedLanguage.CLI, SupportedLanguage.CURL, ]} />
<RelatedSection description="Check the following sections for more on how to write your authorization data" relatedLinks={[ { title: 'Managing User Access', description: 'Learn about how to give a user access to a particular object.', link: '../interacting/managing-user-access', id: '../interacting/managing-user-access.mdx', }, { title: 'Managing Group Access', description: 'Learn about how to give a group of users access to a particular object.', link: '../interacting/managing-group-access', id: '../interacting/managing-group-access.mdx', }, { title: 'Transactional Writes', description: 'Learn about how to update multiple relations within the same API call.', link: '../interacting/transactional-writes', id: '../interacting/transactional-writes.mdx', }, ]} />