The SDK supports four GET variants. Choose the one that matches your use case.
Fetch all documents
Use a simple GET action to return every document in a collection.
{
collection: "users",
endpoint: "/api/users",
request: { type: "GET" },
}
The response contains an array of all documents, each with its Firestore document ID included as id:
{
"status": "success",
"data": [
{ "id": "abc", "name": "Jane", "age": 28, "email": "jane@example.com" }
]
}
Fetch a single document by ID
Add paramKey to read a URL parameter and fetch the matching document by its Firestore document ID.
{
collection: "users",
endpoint: "/api/users/:id",
request: { type: "GET", paramKey: "id" },
}
Example request: GET /api/users/abc123
Success response:
{ "status": "success", "data": { "id": "abc123", "name": "Jane" } }
Not found response:
{
"status": "error",
"message": "No document with id abc123 found in collection users"
}
Filtered query
Add a query object to filter and sort results without a URL parameter.
{
collection: "users",
endpoint: "/api/adults",
request: {
type: "GET",
query: {
attribute: "age",
operator: ">=",
value: 18,
orderBy: "age",
order: "asc",
},
},
}
This returns all users with age >= 18, sorted by age in ascending order. See Filtering & Sorting for the full list of query options.
Filtered query with URL param
Combine paramKey with query to filter a collection using a URL parameter value. The attribute field is omitted — the SDK uses paramKey as the field name and the URL parameter value as the filter value.
{
collection: "users",
endpoint: "/api/users/:email",
request: {
type: "GET",
paramKey: "email",
query: {
operator: "==",
orderBy: "name",
order: "asc",
},
},
}
Example request: GET /api/users/jane@example.com
This returns all users where email == "jane@example.com", sorted by name ascending.
limit cannot be used without also providing operator or order. Omitting both while setting limit throws an error at startup.