cURL
curl --request POST \
--url https://api.osohq.com/api/list \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actor_type": "<string>",
"actor_id": "<string>",
"action": "<string>",
"resource_type": "<string>",
"page_size": 10000
}
'import os
from oso_cloud import Oso, Value
oso = Oso(api_key=os.environ.get('OSO_CLOUD_API_KEY', None))
# List all repositories the user can read
alice = Value("User", "alice")
repository_ids = oso.list(alice, "read", "Repository")
print(f"Readable repositories: {repository_ids}")
# With context facts
issue_ids = oso.list(
alice,
"read",
"Issue",
context_facts=[
("has_relation", Value("Issue", "123"), "parent", Value("Repository", "anvils")),
("has_relation", Value("Issue", "456"), "parent", Value("Repository", "acme"))
]
)
import { Oso } from 'oso-cloud';
const apiKey = process.env.OSO_CLOUD_API_KEY;
const oso = new Oso("https://cloud.osohq.com", apiKey);
// List all repositories the user can read
const alice = { type: "User", id: "alice" };
const repositoryIds = await oso.list(alice, "read", "Repository");
console.log("Readable repositories:", repositoryIds);
// With context facts
const issueIds = await oso.list(
alice,
"read",
"Issue",
[
["has_relation", { type: "Issue", id: "123" }, "parent", { type: "Repository", id: "anvils" }],
["has_relation", { type: "Issue", id: "456" }, "parent", { type: "Repository", id: "acme" }]
]
);
package main
import (
"log"
"os"
oso "github.com/osohq/go-oso-cloud/v2"
)
func main() {
apiKey := os.Getenv("OSO_CLOUD_API_KEY")
osoClient := oso.NewClient("https://cloud.osohq.com", apiKey)
// List all repositories the user can read
user := oso.NewValue("User", "alice")
repositoryIds, err := osoClient.List(user, "read", "Repository", nil)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Readable repositories: %v\n", repositoryIds)
// With context facts
contextFacts := []oso.Fact{
oso.NewFact("has_relation", oso.NewValue("Issue", "123"), oso.String("parent"), oso.NewValue("Repository", "anvils")),
oso.NewFact("has_relation", oso.NewValue("Issue", "456"), oso.String("parent"), oso.NewValue("Repository", "acme")),
}
issueIds, err := osoClient.ListWithContext(user, "read", "Issue", contextFacts)
}
package com.mycompany;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import com.osohq.oso_cloud.Oso;
import com.osohq.oso_cloud.api.ApiException;
import com.osohq.oso_cloud.api.Value;
public class App {
public static void main(String[] args) {
String apiKey = System.getenv("OSO_CLOUD_API_KEY");
Oso oso = new Oso(apiKey);
try {
// List all repositories the user can read
Value alice = new Value("User", "alice");
List<String> repositoryIds = oso.list(alice, "read", "Repository");
System.out.println("Readable repositories: " + repositoryIds);
// With context facts
Value issue1 = new Value("Issue", "123");
Value issue2 = new Value("Issue", "456");
Value repo1 = new Value("Repository", "anvils");
Value repo2 = new Value("Repository", "acme");
List<String> issueIds = oso.list(alice, "read", "Issue", Arrays.asList(
Arrays.asList("has_relation", issue1, "parent", repo1),
Arrays.asList("has_relation", issue2, "parent", repo2)
));
} catch (IOException | ApiException e) {
System.err.println("Error: " + e.getMessage());
}
}
}
require 'oso-cloud'
api_key = ENV.fetch('OSO_CLOUD_API_KEY', nil)
oso = OsoCloud::Oso.new(url: "https://cloud.osohq.com", api_key: api_key)
# List all repositories the user can read
alice = OsoCloud::Value.new(type: "User", id: "alice")
repository_ids = oso.list(alice, "read", "Repository")
puts "Readable repositories: #{repository_ids}"
# With context facts
issue_ids = oso.list(alice, "read", "Issue",
context_facts: [
["has_relation", OsoCloud::Value.new(type: "Issue", id: "123"), "parent", OsoCloud::Value.new(type: "Repository", id: "anvils")],
["has_relation", OsoCloud::Value.new(type: "Issue", id: "456"), "parent", OsoCloud::Value.new(type: "Repository", id: "acme")]
]
)
using OsoCloud;
string? apiKey = Environment.GetEnvironmentVariable("OSO_CLOUD_API_KEY");
var oso = new Oso("https://api.osohq.com", apiKey);
// List all repositories the user can read
var alice = new Value("User", "alice");
var repositoryIds = await oso.List(alice, "read", "Repository");
Console.WriteLine($"Readable repositories: {string.Join(", ", repositoryIds)}");
// With context facts
var issueIds = await oso.List(alice, "read", "Issue",
contextFacts: new[] {
new[] { "has_relation", new Value("Issue", "123"), "parent", new Value("Repository", "anvils") },
new[] { "has_relation", new Value("Issue", "456"), "parent", new Value("Repository", "acme") }
});
{
"results": [
"<string>"
],
"next_page_token": "<string>"
}{
"message": "<string>"
}Authorization Check
Post list
Fetches a list of resource IDs on which an actor can perform a particular action.
POST
/
list
cURL
curl --request POST \
--url https://api.osohq.com/api/list \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actor_type": "<string>",
"actor_id": "<string>",
"action": "<string>",
"resource_type": "<string>",
"page_size": 10000
}
'import os
from oso_cloud import Oso, Value
oso = Oso(api_key=os.environ.get('OSO_CLOUD_API_KEY', None))
# List all repositories the user can read
alice = Value("User", "alice")
repository_ids = oso.list(alice, "read", "Repository")
print(f"Readable repositories: {repository_ids}")
# With context facts
issue_ids = oso.list(
alice,
"read",
"Issue",
context_facts=[
("has_relation", Value("Issue", "123"), "parent", Value("Repository", "anvils")),
("has_relation", Value("Issue", "456"), "parent", Value("Repository", "acme"))
]
)
import { Oso } from 'oso-cloud';
const apiKey = process.env.OSO_CLOUD_API_KEY;
const oso = new Oso("https://cloud.osohq.com", apiKey);
// List all repositories the user can read
const alice = { type: "User", id: "alice" };
const repositoryIds = await oso.list(alice, "read", "Repository");
console.log("Readable repositories:", repositoryIds);
// With context facts
const issueIds = await oso.list(
alice,
"read",
"Issue",
[
["has_relation", { type: "Issue", id: "123" }, "parent", { type: "Repository", id: "anvils" }],
["has_relation", { type: "Issue", id: "456" }, "parent", { type: "Repository", id: "acme" }]
]
);
package main
import (
"log"
"os"
oso "github.com/osohq/go-oso-cloud/v2"
)
func main() {
apiKey := os.Getenv("OSO_CLOUD_API_KEY")
osoClient := oso.NewClient("https://cloud.osohq.com", apiKey)
// List all repositories the user can read
user := oso.NewValue("User", "alice")
repositoryIds, err := osoClient.List(user, "read", "Repository", nil)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Readable repositories: %v\n", repositoryIds)
// With context facts
contextFacts := []oso.Fact{
oso.NewFact("has_relation", oso.NewValue("Issue", "123"), oso.String("parent"), oso.NewValue("Repository", "anvils")),
oso.NewFact("has_relation", oso.NewValue("Issue", "456"), oso.String("parent"), oso.NewValue("Repository", "acme")),
}
issueIds, err := osoClient.ListWithContext(user, "read", "Issue", contextFacts)
}
package com.mycompany;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import com.osohq.oso_cloud.Oso;
import com.osohq.oso_cloud.api.ApiException;
import com.osohq.oso_cloud.api.Value;
public class App {
public static void main(String[] args) {
String apiKey = System.getenv("OSO_CLOUD_API_KEY");
Oso oso = new Oso(apiKey);
try {
// List all repositories the user can read
Value alice = new Value("User", "alice");
List<String> repositoryIds = oso.list(alice, "read", "Repository");
System.out.println("Readable repositories: " + repositoryIds);
// With context facts
Value issue1 = new Value("Issue", "123");
Value issue2 = new Value("Issue", "456");
Value repo1 = new Value("Repository", "anvils");
Value repo2 = new Value("Repository", "acme");
List<String> issueIds = oso.list(alice, "read", "Issue", Arrays.asList(
Arrays.asList("has_relation", issue1, "parent", repo1),
Arrays.asList("has_relation", issue2, "parent", repo2)
));
} catch (IOException | ApiException e) {
System.err.println("Error: " + e.getMessage());
}
}
}
require 'oso-cloud'
api_key = ENV.fetch('OSO_CLOUD_API_KEY', nil)
oso = OsoCloud::Oso.new(url: "https://cloud.osohq.com", api_key: api_key)
# List all repositories the user can read
alice = OsoCloud::Value.new(type: "User", id: "alice")
repository_ids = oso.list(alice, "read", "Repository")
puts "Readable repositories: #{repository_ids}"
# With context facts
issue_ids = oso.list(alice, "read", "Issue",
context_facts: [
["has_relation", OsoCloud::Value.new(type: "Issue", id: "123"), "parent", OsoCloud::Value.new(type: "Repository", id: "anvils")],
["has_relation", OsoCloud::Value.new(type: "Issue", id: "456"), "parent", OsoCloud::Value.new(type: "Repository", id: "acme")]
]
)
using OsoCloud;
string? apiKey = Environment.GetEnvironmentVariable("OSO_CLOUD_API_KEY");
var oso = new Oso("https://api.osohq.com", apiKey);
// List all repositories the user can read
var alice = new Value("User", "alice");
var repositoryIds = await oso.List(alice, "read", "Repository");
Console.WriteLine($"Readable repositories: {string.Join(", ", repositoryIds)}");
// With context facts
var issueIds = await oso.List(alice, "read", "Issue",
contextFacts: new[] {
new[] { "has_relation", new Value("Issue", "123"), "parent", new Value("Repository", "anvils") },
new[] { "has_relation", new Value("Issue", "456"), "parent", new Value("Repository", "acme") }
});
{
"results": [
"<string>"
],
"next_page_token": "<string>"
}{
"message": "<string>"
}Authorizations
Requires an API key to access.
Body
application/json
Required. Page size for pagination. Must be at least 10,000. Results will be paginated and a next_page_token will be included in the response if more results are available. Ignored when page_token is provided, since the page size is determined by the original request.
Required range:
x >= 10000Show child attributes
Show child attributes
Page token for fetching subsequent pages of results. Use the next_page_token from a previous response. When provided, page_size is ignored.
Was this page helpful?
⌘I