<@U04UQ68083H> Using the Ory SDK for node.js, what...
# ory-copilot
c
@chilly-king-10285 Using the Ory SDK for node.js, what is the method on the
RelationshipApi
that I would use to get a list of all the tuples for a
subject-id
in a given namespace, for example “Roles”
b
A message from kapa.ai
To get a list of all the tuples for a specific
subject-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:
Copy code
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).