Skip to main content
Version: 2.0.0

list

List resource instances defined within the environment.

Parameters

tenant (optional) - The tenant key or id to filter by
relation (optional) - The relation id or key to filter by
subject (optional) - The subject to filter by, accepts either the resource instance id or resource_type:resource_instance
subjectType (optional) - The subject type to filter by, accepts resource type id or key
object (optional) - The object to filter by, accepts either the resource instance id or resource_type:resource_instance
objectType (optional) - The object type to filter by, accepts resource type id or key
page (optional) - The page number of the results to fetch, starting at page 1
perPage (optional) - The number of results per page (maximum of 100)
include_total_count (optional) - The total count of relationship tuples that match the specified filters of the request

Implementation

await permit.api.relationshipTuples.list({
tenant: "default",
relation: "parent",
subject: "file:file-1",
subjectType: "file",
object: "folder:folder-1",
objectType: "folder",
page: 1,
perPage: 20,
include_total_count: true
});

Result

[
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"subject": "organization:permitio",
"relation": "owner",
"object": "repo:opal",
"tenant": "stripe-inc",
"subject_id": "7c60d51f-b44e-4682-87d6-449835ea4d11",
"relation_id": "405d8375-3514-403b-8c43-83ae74cfe022",
"object_id": "12f84e49-af17-4b0c-8cd7-01258769c2ba",
"tenant_id": "40ef0e48-a11f-4963-a229-e396c9f7e733",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"environment_id": "40ef0e48-a11f-4963-a229-e396c9f7e7c4",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]

When include_total_count query param set to true

{
data: [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"subject": "organization:permitio",
"relation": "owner",
"object": "repo:opal",
"tenant": "stripe-inc",
"subject_id": "7c60d51f-b44e-4682-87d6-449835ea4d11",
"relation_id": "405d8375-3514-403b-8c43-83ae74cfe022",
"object_id": "12f84e49-af17-4b0c-8cd7-01258769c2ba",
"tenant_id": "40ef0e48-a11f-4963-a229-e396c9f7e733",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"environment_id": "40ef0e48-a11f-4963-a229-e396c9f7e7c4",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
total_count: 1 ,
pagination_count: 1
}