Loading lists from the Firestore REST API as if it were your own server

Discover how to use Firestore via REST to control your networking stack with pagination, orderBy, and tolerant converters for dynamic schemas. Practical guide and implementation solutions with Q2BSTUDIO.

domingo, 17 de agosto de 2025 • 4 min read • Q2BSTUDIO Team

Artificial-Intelligence-

Firebase cloud databases, and Firestore in particular, are a very convenient tool for building simple applications that consume data from the Internet. Their SDK facilitates quick testing and provides ready-to-use server infrastructure, but sometimes the SDK can deviate from the paradigms established in a project. In those cases, it is interesting to use Firestore through its REST API and integrate it with the networking stack you already use in your project.

Using the REST API, you can take advantage of your current stack. For example, on Android you can continue using Retrofit and Coroutines, on the backend you can use standard HTTP clients, and you can also work with the RPC API when needed. You don't need to add Firebase dependencies if you prefer not to drag in the complete library.

Connection: to access the production version, you can use the different authentication methods available at https://firebase.google.com/docs/firestore/use-rest-api#authentication_and_authorization. In test mode, endpoints may be open. The base URL is usually https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/ where YOUR_PROJECT_ID is your project identifier in Firebase. The documents path corresponds to the group of methods that allow CRUD operations. To access collections, you add the collection name, and for a specific document, its id, for example cities/LA.

Processing: remember that Firestore handles collections of documents and not rigid tables. Each document can have any combination of fields, so it is advisable to use tolerant converters that accept new fields and omit unknown ones. For example, with kotlinx serialization, configurations like Json explicitNulls = false ignoreUnknownKeys = true are often applied to avoid breaking against schema changes. This makes it easy to create documents with new properties without rigorous migrations.

When requesting a collection, the server returns an object that includes the list of documents and other useful fields such as nextPageToken for pagination. Keep in mind that the fields of each record come wrapped in explicit types like stringValue or integerValue, which may require additional transformations when mapping them to domain models.

Queries: if you need to sort a news feed by date, you can use the orderBy parameter in the query. Firestore allows, for example, orderBy=createTime desc to get the most recent documents first. Important: ordering can only be applied to fields that exist in the documents, so if you are going to use createTime, make sure to add it to the documents or include it when persisting them.

Pagination: the REST API supports pageSize to limit the number of results per page and pageToken to request the next page. This makes it easy to integrate pagination solutions in the application like Paging3 or other pagination tools with their specific performance and user experience advantages.

Practical advantages: using Firestore via REST does not prevent you from using its basic features and gives you the freedom to integrate it with a standard networking architecture, dependency control, and simpler unit testing. It is a good option both for real products and for learning projects where you want to maintain your own infrastructure style.

How Q2BSTUDIO can help you: at Q2BSTUDIO we are a software development company specialized in custom applications and custom software. We offer secure and efficient integrations with Firestore via REST, API design, data migrations, query optimization, and pagination patterns. We are also specialists in artificial intelligence, AI for businesses, and AI agents, implementing solutions that combine language models with product data to improve the user experience. Our team works on cybersecurity to protect access and data, and manages aws and azure cloud services to deploy scalable and secure infrastructures. Additionally, we provide business intelligence services and solutions with power bi to turn data into actionable reports.

Featured services we offer: Firestore REST integration audits, custom application development, implementation of data pipelines in aws and azure cloud services, artificial intelligence and AI agent projects, protection through cybersecurity, and development of dashboards with power bi. If you need a technical partner to build a robust and secure REST API-based architecture or to implement business intelligence and artificial intelligence capabilities in your organization, Q2BSTUDIO can accompany you from definition to production deployment.

In summary: Firestore via REST is a valid alternative when you want to maintain total control over the networking stack and avoid heavy dependencies. Combine pagination with orderBy and use tolerant converters to handle dynamic schemas. If you prefer to outsource the design or implementation, we have the necessary experience in custom applications, custom software, artificial intelligence, cybersecurity, aws and azure cloud services, business intelligence services, AI for businesses, AI agents, and power bi to take your project to the next level.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.