careful-honey-27437
10/25/2024, 3:26 AMRelationshipApi
that I would use to get a list of all the tuples for a subject-id
in a given namespace, for example “Roles”brief-egg-61061
10/25/2024, 3:26 AMbrief-egg-61061
10/25/2024, 3:26 AMsubject-id
in a given namespace using the Ory SDK for Node.js, you would use the getRelationships
method on the RelationshipApi
. This method allows you to query relationships based on various parameters, including the namespace and subject ID. Here's how you would typically use it: javascript const relationshipApi = new Ory.RelationshipApi(); const params = { namespace: 'Roles', subject_id: 'your-subject-id-here' }; relationshipApi.getRelationships(params) .then((response) => { console.log(response.data); }) .catch((error) => { console.error(error); });
The getRelationships
method accepts several query parameters, allowing you to filter the results as needed. In this case, you would specify the namespace
as "Roles" and provide the subject_id
you're interested in. This method is documented in the Ory API Reference [here](https://www.ory.sh/docs/reference/api) and [here](https://www.ory.sh/docs/keto/reference/rest-api). It returns a paginated list of relationships that match your query criteria. Remember that this method is part of the read API for querying relationships, as mentioned in the [Keto Protocol Documentation](https://www.ory.sh/docs/keto/reference/proto-api#readservice).