Retrieving resources
There are three ways to retrieve resources: by ID, by filtering on metadata/attributes, or by searching (best for fuzzier, content-driven, or semantic retrieval). Each uses a dedicated endpoint.
Get by ID
Endpoint: /v2/resources/{resourceId}
The simplest way to get a single resource is by using its ID. This will return metadata like the name, media type, thumbnail, size etc.
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const results = await api.resources.get({
resourceId: 'c99c57c3-34f5-4fde-a678-f9815cd99db5',
});
curl https://api.exabase.io/v2/resources/c99c57c3-34f5-4fde-a678-f9815cd99db5 \
-X GET \
-H 'X-Api-Key: <EXABASE_API_KEY>'
Filter
Endpoint: /v2/resources/filter
List resources matching one or more criteria like location, creation date, or kind. Results can be sorted by creation time, modification time, name, or kind.
This endpoint uses cursor-based pagination with a default page size of 20 (adjustable via limit). To fetch the next page, pass the nextCursor value from the response as cursor in the following request.
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const results = await api.resources.filter({
parentId: 'c99c57c3-34f5-4fde-a678-f9815cd99db5',
name: 'receipt',
order: {
property: 'name',
},
});
curl https://api.exabase.io/v2/resources/filter \
-X POST \
-H 'X-Api-Key: <EXABASE_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"parentId": "c99c57c3-34f5-4fde-a678-f9815cd99db5",
"name": "receipt",
"order": {
"property": "name"
}
}'