Easy querying with RunQuery API
Firestore offers a straightforward way to query your data using a REST API-based mechanism called the RunQuery API. This API allows you to retrieve specific data from your Firestore database using HTTP requests.
API endpoint and method
To use the RunQuery API, you make a POST request to the following endpoint:
https://firestore.googleapis.com/v1/{parent=projects/*/databases/*/documents}:runQuery
The parent parameter
In the API request, you’ll need to provide the parent
parameter with a value in this format:
projects/{project_id}/databases/{databaseId}/documents
Replace {project_id}
and {databaseId}
with your specific project and database identifiers.
JSON body format
The request body should be in JSON format and include the structuredQuery
object, which defines the specifics of your query. The structuredQuery
object contains various query parameters, such as select
, from
, where
, orderBy
, startAt
, endAt
, offset
, and limit...