<@U04UQ68083H> Ory client-fetch SDK question …
# ory-copilot
c
@chilly-king-10285 Ory client-fetch SDK question …
b
A message from kapa.ai
I'm happy to help with your Ory client-fetch SDK question! However, your message does not include a specific question. Please provide more details or clarify what you'd like to know about the Ory client-fetch SDK, such as installation, usage, configuration, or troubleshooting. Once you provide your specific question, I'll answer it using the information from the knowledge sources.
c
@chilly-king-10285 Using the client-fetch sdk for node.js, can I use the
getRelationships
method to list all the relationships for a subject under a specific Namespace?
b
A message from kapa.ai
Yes, you can use the
getRelationships
method to list all relationships for a subject under a specific namespace. The API allows you to filter relationships by various parameters, including
namespace
and
subject_id
. By specifying both the
namespace
and the
subject_id
in your query, you will retrieve all relationships for that subject within the given namespace. Here’s how the relevant query parameters are described: -
namespace
(string, optional): Namespace of the Relationship -
subject_id
(string, optional): SubjectID of the Relationship Only the
namespace
field is required, but you can combine it with
subject_id
to filter the results as needed. This is supported by the REST API, which the client-fetch SDK wraps for Node.js usage:
Copy code
GET /relation-tuples?namespace=<namespace>&subject_id=<subject_id>
This will return all relationships for the specified subject in the given namespace [Ory API Reference – getRelationships](https://www.ory.sh/docs/reference/api) [Ory Keto REST API Reference – getRelationships](https://www.ory.sh/docs/keto/reference/rest-api). If you need a code example or further details on using the client-fetch SDK specifically, please let me know!
c
@chilly-king-10285 What are all the args/parameters I can pass to this method?
b
A message from kapa.ai
When using the
getRelationships
method (which maps to the
GET /relation-tuples
endpoint), you can pass the following query parameters: -
page_token
(string, optional): For pagination, the token to retrieve the next page. -
page_size
(integer, optional): The number of results per page. -
namespace
(string, optional): Namespace of the relationship. -
object
(string, optional): Object of the relationship. -
relation
(string, optional): Relation of the relationship. -
subject_id
(string, optional): SubjectID of the relationship. -
subject_set.namespace
(string, optional): Namespace of the subject set. -
subject_set.object
(string, optional): Object of the subject set. -
subject_set.relation
(string, optional): Relation of the subject set. You can use any combination of these parameters to filter your query. Only the
namespace
field is required to perform a basic query, but you can refine your search by including additional parameters as needed [Ory Keto REST API Reference – getRelationships](https://www.ory.sh/docs/keto/reference/rest-api). Here’s a summary table for clarity: | Parameter | Type | Description | |--------------------------|----------|------------------------------------| | page_token | string | Pagination token | | page_size | integer | Number of results per page | | namespace | string | Namespace of the relationship | | object | string | Object of the relationship | | relation | string | Relation of the relationship | | subject_id | string | SubjectID of the relationship | | subject_set.namespace | string | Namespace of the subject set | | subject_set.object | string | Object of the subject set | | subject_set.relation | string | Relation of the subject set |