gerstams
gerstams

Reputation: 445

Google Firestore - REST API without pagination

I've set up a database in Google Firebase - Firestore and already uploaded just about 500 documents into a single collection.

Now, I've also figured out the REST API to read "all" of the documents from that collection:

GET https://firestore.googleapis.com/v1/projects/my-project/databases/(default)/documents/my-collection

This request returns following response structure:

{
    "documents": [
        {
            "name": "projects/my-project/databases/(default)/documents/my-collection/3D-Technologien7a69809a-dc97-4663-a661-2df3f6f034dd",
            "fields": {
                "start": {
                    "stringValue": "28.10.2021"
                },
                "location": {
                    "stringValue": "Hb"
                },
                "name": {
                    "stringValue": "3D-Technologien"
                },
                "end": {
                    "stringValue": "30.10.2021"
                }
            },
            "createTime": "2020-10-09T16:22:53.865356Z",
            "updateTime": "2020-10-09T16:22:53.865356Z"
        }
    ],
    "nextPageToken": "AFTOeJymPSjChtwIgEMwViyHTAnXjWr_wNAQ7t8h9ZioAI-tJRX7WxdS7TBCeHvREsNgmEGOSLtuDI_YCjIWU2BdlT1-QDoIPHtG4QCxxcjJaSB5NRA-o7smLhr6Pxil0tPUlLBdiLwyjOD-c7qm7QNTR9SqL7HNI3uNKbZi7MG3ng-WMLpoN6MWZ7uGjQGpgfysbwk"
}

It's pretty clear that the response is based on pagination, but I don't find any documentation on this and even worse, on how to adjust this. Currently, max. 20 documents are being returned for the request. I want all 500 to be returned.

Is there any configuration option for this?

Upvotes: 0

Views: 664

Answers (1)

windowsill
windowsill

Reputation: 3649

According to the docs you can use query params pageSize and pageToken

?pageSize=20&pageToken=ABCDEF1234567890

https://cloud.google.com/firestore/docs/reference/rest/v1beta1/projects.databases.documents/list

Upvotes: 2

Related Questions