Developer

Resources API

Read resource metadata from your custom resource.

Resources API

The Resources API provides read-only access to resource metadata. Use it to discover other resources in the workspace, for cross-resource integrations or dashboards.

Capability required: resources:read

Frontend (iframe)

import { createResourceClient } from "@rightplace/sdk";

const rp = createResourceClient();
await rp.ready();

// List all resources across all projects
const all = await rp.resources.list();
// -> [{ id: "r1", name: "My API", type: "custom/api-monitor", projectId: "p1" }, ...]

// List resources in a specific project
const projectResources = await rp.resources.list("project-id-here");

Backend (Node.js)

import { createResourceServer } from "@rightplace/sdk/server";

const server = createResourceServer({
  methods: {
    getDashboardData: async (_params, { rp }) => {
      const resources = await rp.resources.list();
      return {
        totalResources: resources.length,
        byType: resources.reduce((acc, r) => {
          acc[r.type] = (acc[r.type] || 0) + 1;
          return acc;
        }, {}),
      };
    },
  },
});

server.start();

API Reference

rp.resources.list(projectId?)

ParameterTypeDescription
projectIdstring (optional)Filter by project ID. Omit to list all resources.
ReturnsPromise<ResourceInfo[]>Array of resource metadata

ResourceInfo

FieldTypeDescription
idstringResource ID
namestringResource display name
typestringResource type (e.g. wordpress, custom/my-type)
projectIdstringOwning project ID

Manifest Configuration

{
  "capabilities": [
    "resources:read"
  ]
}

Notes

  • This API is read-only. Resources cannot create, update, or delete other resources.
  • The configJson is not exposed to prevent leaking credentials or connection details between resources.
  • Results include both built-in and custom resource types.