7

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.

4

1 Answer 1

2

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

1
  • 3
    Could you elaborate on that? Why doesn't the REST API support listeners? The RPC documentation is very vague too. May 10, 2019 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.