cURL
curl --request POST \
--url https://api.osohq.com/api/actions_query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": {
"actor_type": "<string>",
"actor_id": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"context_facts": []
},
"data_bindings": "<string>"
}
'from oso_cloud import Oso, Value
import os
from sqlalchemy import text
from oso_cloud import Oso, Value
oso = Oso(api_key=os.environ.get('OSO_CLOUD_API_KEY', None))
# Generate actions query SQL
alice = Value("User", "alice")
issue = Value("Issue", "123")
query = oso.actions_local(alice, issue)
# Execute with SQLAlchemy
actions = list(session.execute(text(query)).scalars())
print(f"Available actions: {actions}")
import { Oso } from 'oso-cloud';
const apiKey = process.env.OSO_CLOUD_API_KEY;
const oso = new Oso("https://cloud.osohq.com", apiKey);
// Generate actions query SQL
const alice = { type: "User", id: "alice" };
const issue = { type: "Issue", id: "123" };
const query = await oso.actionsLocal(alice, issue);
// Execute with database
const result = await sql.raw(query).execute(db);
const actions = result.rows.map(row => row.actions);
console.log("Available actions:", actions);
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)
// Generate actions query SQL
alice := oso.NewValue("User", "alice")
issue := oso.NewValue("Issue", "123")
query, err := osoClient.ActionsLocal(alice, issue)
if err != nil {
log.Fatal(err)
}
// Execute with GORM
var actions []string
db.Raw(query).Pluck("actions", &actions)
fmt.Printf("Available actions: %v\n", actions)
}
package com.mycompany;
import java.io.IOException;
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 {
// Generate actions query SQL
Value alice = new Value("User", "alice");
Value issue = new Value("Issue", "123");
String query = oso.actionsLocal(alice, issue);
// Execute with database (example with JPA/Hibernate)
List<String> actions = entityManager.createNativeQuery(query)
.getResultList();
System.out.println("Available actions: " + actions);
} 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)
# Generate actions query SQL
alice = OsoCloud::Value.new(type: "User", id: "alice")
issue = OsoCloud::Value.new(type: "Issue", id: "123")
query = oso.actions_local(alice, issue)
# Execute with ActiveRecord
actions = ActiveRecord::Base.connection.execute(query).values.flatten
puts "Available actions: #{actions}"
using OsoCloud;
using System.Data;
string? apiKey = Environment.GetEnvironmentVariable("OSO_CLOUD_API_KEY");
var oso = new Oso("https://api.osohq.com", apiKey);
// Generate actions query SQL
var alice = new Value("User", "alice");
var issue = new Value("Issue", "123");
string query = await oso.ActionsLocal(alice, issue);
// Execute with Entity Framework
var actions = await context.Database.SqlQueryRaw<string>(query).ToListAsync();
Console.WriteLine($"Available actions: {string.Join(", ", actions)}");
{
"sql": "<string>"
}{
"message": "<string>"
}Local Check API
Post actions query
POST
/
actions_query
cURL
curl --request POST \
--url https://api.osohq.com/api/actions_query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": {
"actor_type": "<string>",
"actor_id": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"context_facts": []
},
"data_bindings": "<string>"
}
'from oso_cloud import Oso, Value
import os
from sqlalchemy import text
from oso_cloud import Oso, Value
oso = Oso(api_key=os.environ.get('OSO_CLOUD_API_KEY', None))
# Generate actions query SQL
alice = Value("User", "alice")
issue = Value("Issue", "123")
query = oso.actions_local(alice, issue)
# Execute with SQLAlchemy
actions = list(session.execute(text(query)).scalars())
print(f"Available actions: {actions}")
import { Oso } from 'oso-cloud';
const apiKey = process.env.OSO_CLOUD_API_KEY;
const oso = new Oso("https://cloud.osohq.com", apiKey);
// Generate actions query SQL
const alice = { type: "User", id: "alice" };
const issue = { type: "Issue", id: "123" };
const query = await oso.actionsLocal(alice, issue);
// Execute with database
const result = await sql.raw(query).execute(db);
const actions = result.rows.map(row => row.actions);
console.log("Available actions:", actions);
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)
// Generate actions query SQL
alice := oso.NewValue("User", "alice")
issue := oso.NewValue("Issue", "123")
query, err := osoClient.ActionsLocal(alice, issue)
if err != nil {
log.Fatal(err)
}
// Execute with GORM
var actions []string
db.Raw(query).Pluck("actions", &actions)
fmt.Printf("Available actions: %v\n", actions)
}
package com.mycompany;
import java.io.IOException;
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 {
// Generate actions query SQL
Value alice = new Value("User", "alice");
Value issue = new Value("Issue", "123");
String query = oso.actionsLocal(alice, issue);
// Execute with database (example with JPA/Hibernate)
List<String> actions = entityManager.createNativeQuery(query)
.getResultList();
System.out.println("Available actions: " + actions);
} 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)
# Generate actions query SQL
alice = OsoCloud::Value.new(type: "User", id: "alice")
issue = OsoCloud::Value.new(type: "Issue", id: "123")
query = oso.actions_local(alice, issue)
# Execute with ActiveRecord
actions = ActiveRecord::Base.connection.execute(query).values.flatten
puts "Available actions: #{actions}"
using OsoCloud;
using System.Data;
string? apiKey = Environment.GetEnvironmentVariable("OSO_CLOUD_API_KEY");
var oso = new Oso("https://api.osohq.com", apiKey);
// Generate actions query SQL
var alice = new Value("User", "alice");
var issue = new Value("Issue", "123");
string query = await oso.ActionsLocal(alice, issue);
// Execute with Entity Framework
var actions = await context.Database.SqlQueryRaw<string>(query).ToListAsync();
Console.WriteLine($"Available actions: {string.Join(", ", actions)}");
{
"sql": "<string>"
}{
"message": "<string>"
}Was this page helpful?
⌘I