#hii

1 messages · Page 1 of 1 (latest)

rustic briar
#

hey @small light, your request looks good. Could you also share the relevant part of your schema? That way, I can dig in better.

small light
#

hii

this is my schema
entity user {}

entity document {
relation admin @user
relation viewer @user

action view = viewer or admin
action delete = admin or viewer

}

entity folder {
relation admin @user
relation viewer @user
relation parent @document

action view = viewer or admin or parent.viewer
action delete = admin or parent.viewer or parent.admin

}

and this is my api call for write the relationships
api:- http://localhost:3476/v1/tenants/t4/relationships/write
{
"metadata": {
"schema_version": "cudg04gv9jpl52ik08h0"
},
"tuples": [
{
"entity": { "type": "folder", "id": "1" },
"relation": "viewer",
"subject": { "type": "user", "id": "1" }
},
{
"entity": { "type": "folder", "id": "1" },
"relation": "viewer",
"subject": { "type": "user", "id": "2" }
},
{
"entity": { "type": "folder", "id": "1" },
"relation": "viewer",
"subject": { "type": "user", "id": "3" }
}
]
}

and this my delete api
api:- http://localhost:3476/v1/tenants/t4/data/delete

{
"metadata": {
"schema_version": "cudg04gv9jpl52ik08h0",
"snap_token": "JEPjBUJeHxg="
},
"tuple_filter": {
"entity": {
"type": "folder",
"id": "1"
},
"relation": "viewer",
"subject": {
"type": "user",
"id": "1"
}
},
"attribute_filter": {}
}

i am share the screen shot with you also

#

now this are the image after delete api

#

using new snap token which as the response of the delete api

#

Thanks in advance for helping me

small light
#

@rustic briar

rustic briar
#

hi @small light, i just woke up sorry. just checked your requests and realized your delete request body looks wrong. can you try following for delete api?
`api:- http://localhost:3476/v1/tenants/t4/data/delete

{
"metadata": {
"schema_version": "cudg04gv9jpl52ik08h0",
"snap_token": "JEPjBUJeHxg="
},
"tuple_filter": {
"entity": {
"type": "folder",
"ids": [ "1"]
},
"relation": "viewer",
"subject": {
"type": "user",
"ids": [ "1"]
}
},
"attribute_filter": {}
}`

#

we will be working on validation of requests for such cases. thanks for noticing!

small light
#

thank you

#

i will let you know the result of this updated api

small light
#

Thank you so much it's working fine now

i think it's because of the ids before i was using just id

also try with "id":["1"] but now it's work fine with "ids":["1"]