0
votes

I have a firestore database as below My firestore database

I would like to query the CASH AND CREDT amount for document 20191003. I used the below REST api

POST https://firestore.googleapis.com/v1/projects/badansales/databases/(default)/documents/sales/20191003:runQuery?key={YOUR_API_KEY}

{
 "structuredQuery": {
  "select": {
   "fields": [
    {
     "fieldPath": "CASH"
    },
    {
     "fieldPath": "CREDT"
    }
   ]
  }
 }
}

But the response is as below

{
 "0": {
  "readTime": "2019-10-04T02:03:57.366908Z"
 }
}

Can someone help on this? Thanks

1

1 Answers

2
votes

I'd advise reading the documentation here: https://firebase.google.com/docs/firestore/use-rest-api#making_rest_calls which recommends checking out the API Explorer. This can help you create a query.

For your example, maybe try:

GET https://firestore.googleapis.com/v1/projects/badansales/databases/(default)/documents/sales/20191003?key={YOUR_API_KEY}

Notice two things:

  • It's a GET and not a POST (there's no alteration of the data here).