Skip to content

Commit bd6e328

Browse files
committed
chore: use the WriteRequestViewer
1 parent 4176035 commit bd6e328

1 file changed

Lines changed: 54 additions & 29 deletions

File tree

blog/ignore-duplicate-writes-announcement.md

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ image: https://openfga.dev/img/og-rich-embed.png
99
hide_table_of_contents: false
1010
---
1111

12+
import {
13+
SupportedLanguage,
14+
WriteRequestViewer,
15+
} from '@components/Docs';
16+
1217
# Announcing "Ignore Duplicate Writes" in OpenFGA
1318

1419
We've added two new optional parameters to the Write API endpoint to improve the experience of writing data to FGA. You can now gracefully ["ignore" duplicate writes and missing deletes](https://openfga.dev/docs/getting-started/update-tuples#05-ignoring-duplicate-or-missing-tuples).
@@ -31,35 +36,55 @@ Now, you can send large batches of writes and deletes without worrying about the
3136

3237
## See it in Action
3338

34-
Here's an example cURL request showing the new parameters:
35-
36-
```bash
37-
curl -X POST $FGA_API_URL/stores/$FGA_STORE_ID/write \
38-
-H "Authorization: Bearer $FGA_API_TOKEN" \
39-
-H "content-type: application/json" \
40-
-d '{
41-
"writes": {
42-
"tuple_keys": [
43-
{
44-
"user": "user:anne",
45-
"relation": "viewer",
46-
"object": "document:123"
47-
}
48-
],
49-
"on_duplicate": "ignore"
50-
},
51-
"deletes": {
52-
"tuple_keys": [
53-
{
54-
"user": "user:anne",
55-
"relation": "owner",
56-
"object": "document:123"
57-
}
58-
],
59-
"on_missing": "ignore"
60-
}
61-
}'
62-
```
39+
For Writes:
40+
41+
<WriteRequestViewer
42+
relationshipTuples={[
43+
{
44+
user: 'user:anne',
45+
relation: 'viewer',
46+
object: 'document:roadmap'
47+
},
48+
]}
49+
conflictOptions={{
50+
onDuplicateWrites: 'ignore',
51+
}}
52+
skipSetup={true}
53+
allowedLanguages={[
54+
SupportedLanguage.JS_SDK,
55+
SupportedLanguage.GO_SDK,
56+
SupportedLanguage.DOTNET_SDK,
57+
SupportedLanguage.PYTHON_SDK,
58+
SupportedLanguage.JAVA_SDK,
59+
SupportedLanguage.CLI,
60+
SupportedLanguage.CURL,
61+
]}
62+
/>
63+
64+
And deletes:
65+
66+
<WriteRequestViewer
67+
relationshipTuples={[
68+
{
69+
user: 'user:anne',
70+
relation: 'owner',
71+
object: 'document:roadmap'
72+
},
73+
]}
74+
conflictOptions={{
75+
onMissingDeletes: 'ignore',
76+
}}
77+
skipSetup={true}
78+
allowedLanguages={[
79+
SupportedLanguage.JS_SDK,
80+
SupportedLanguage.GO_SDK,
81+
SupportedLanguage.DOTNET_SDK,
82+
SupportedLanguage.PYTHON_SDK,
83+
SupportedLanguage.JAVA_SDK,
84+
SupportedLanguage.CLI,
85+
SupportedLanguage.CURL,
86+
]}
87+
/>
6388

6489
## Get Started
6590

0 commit comments

Comments
 (0)