I'm trying to understand what I'm doing wrong but ...
# talk-keto
a
I'm trying to understand what I'm doing wrong but cant really figure it out. It looks like I should be able to do an expansion with the REST API, as the command line returns what I would expect:
Copy code
> keto expand view facilities facility-43
neither flag --read-remote nor env var KETO_READ_REMOTE are set, falling back to 127.0.0.1:4466
∪ facilities:facility-43#view
├─ ∪ groups:group-43#member
│  ├─ ☘ user-43️
while the REST API seems to not understand my namespace:
Copy code
> curl -X GET -H 'Accept: application/json' -H 'Accept-Encoding: gzip, deflate' -H 'Connection: keep-alive' -H 'Content-Type: application/json' -H 'User-Agent: python-requests/2.27.1' -d '{"namespace": "facilities", "object": "facility-43", "relation": "view"}' <http://localhost:4466/relation-tuples/expand>
{"error":{"code":404,"status":"Not Found","reason":"Unknown namespace with name \"\".","message":"The requested resource could not be found"}}
and there is a namespace there:
Copy code
> psql keto -c 'select distinct namespace from keto_relation_tuples'
 namespace
------------
 facilities
 groups
(2 rows)
r
IMO it’s form data, not json
-d namespace=facilities&so=on
a
Copy code
> curl -X GET -H 'Accept: application/json' '<http://localhost:4466/relation-tuples/expand?namespace=facilities&object=facility-43&relation=view>'
{"type":"union","children":[{"type":"union","children":[{"type":"leaf","subject_id":"user-43"}],"subject_set":{"namespace":"groups","object":"group-43","relation":"member"}}],"subject_set":{"namespace":"facilities","object":"facility-43","relation":"view"}}
Thanks, Interesting that it breaks on this one but not on other endpoints i.e. I can PUT and DELETE with a JSON body but not make a GET Which I admit is odd, but is allowed by the spec: https://stackoverflow.com/questions/978061/http-get-with-request-body
r
Might be worth a ticket so someone can reply? Or maybe it’s already fixed but unreleased.
n
Hi, and thanks for digging deeper, @average-airport-82192! The expand endpoint uses GET, so the parameters need to be in the URL.