7
votes

Do you know how to setup Firestore listening using REST API. This is my attempt:

url: "https://firestore.googleapis.com/v1beta1/projects/project_name/databases/(default)/documents:listen"
headers: {["Content-Type"] = "application/json"}

body: "{"addTarget": { 
            "once" : false, 
            "documents" : { 
                    "documents" : [ "projects/project_name/databases/(default)/documents/Users/USER_DOC_ID" ]
                        }
            }}"

Request verb: POST 

And the response:

  [{
    "error": {
      "code": 400,
      "message": "Invalid value (Object), ",
      "status": "INVALID_ARGUMENT",
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.BadRequest",
          "fieldViolations": [
            {
              "description": "Invalid value (Object), "
            }
          ]
        }
      ]
    }
  }
  ]

Most propably, my request body is invalid. I used this reference: https://firebase.google.com/docs/reference/rest/firestore/v1beta1/projects.databases/listen

How is the body should look like? Thanks in advance.

1
I am a google group and now I was told that this function does not work. groups.google.com/forum/#!forum/google-cloud-firestore-discuss - sinmetal
according to his document, there is not related restful api to streaming the update of data - Xin Meng
Can some body post example how listen to changes ? or can ask google to remove the page developers.google.com/apis-explorer/#search/firestore/firestore/… - Guy Luz
Does REST api support this in 2021? Or still no luck? - Jakub Szlaur

1 Answers

2
votes

The listen method is not available through the REST API. It is available through the RPC API.