Get Entity Details

Observable: Get Entity Details

User Intent

"I want to retrieve full details for a specific entity"

Operation

  • SDK Method: graphlit.queryObservables()

  • GraphQL: observables query

  • Entity Type: Observable

  • Common Use Cases: View entity summary details, diagnose extraction, check occurrence counts

TypeScript (Canonical)

import { Graphlit } from 'graphlit-client';
import {
  ContentFilterInput,
  ObservableTypes,
} from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const observableId = 'observable-id-here';

const response = await graphlit.queryObservables({
  contents: [{ id: 'content-id-here' }],
  observables: [{ id: observableId }],
});

const observable = response.observables?.results?.[0];

if (!observable) {
  console.log('Observable not found');
  process.exit(0);
}

console.log(`Entity: ${observable.observable.name}`);
console.log(`Type: ${observable.type}`);

if (observable.observable.description) {
  console.log(`Description: ${observable.observable.description}`);
}

Query observable (snake_case)

result = await graphlit.client.query_observables( filter={ "observables": [{"id": observable_id}], "contents": [{"id": content_id}] } )

observable = (result.observables.results or [None])[0]

if observable: print(f"Entity: {observable.observable.name}") print(f"Type: {observable.type}") else: print("Observable not found")


**C#**:
```csharp
using Graphlit;

var client = new Graphlit();

var observableId = "observable-id-here";

var result = await graphlit.QueryObservables(new ContentFilter
{
    Observables = new[] { new EntityReferenceFilter { Id = observableId } },
    Contents = new[] { new EntityReferenceFilter { Id = contentId } }
});

var observable = result.Observables?.Results?.FirstOrDefault();

if (observable is null)
{
    Console.WriteLine("Observable not found");
    return;
}

Console.WriteLine($"Entity: {observable.Observable?.Name}");
Console.WriteLine($"Type: {observable.Type}");

Parameters

  • filter.observables (EntityReferenceFilterInput[]): One or more observable references (IDs, URIs, names)

  • filter.contents (EntityReferenceFilterInput[], optional): Scope to specific content items

  • filter.types (ObservableTypes[], optional): Restrict to certain entity types (Person, Organization, etc.)

  • filter.search (string, optional): Keyword search across observable names

Response

{
  observables: {
    results: Array<{
      type: ObservableTypes;
      observable: {
        id: string;
        name?: string;
        description?: string;
      };
    }>;
  };
}

Last updated

Was this helpful?