Hi,
I want to post this as Https request:
POST https://firestore.googleapis.com/v1beta1/projects/.../documents:runQuery?key={MY_API_KEY}
{ "structuredQuery": { "select": { "fields": [ ] }, "from": [ { "collectionId": "Instances" } ], "where": { "fieldFilter": { "field": { "fieldPath": "Occupied" }, "op": "EQUAL", "value": { "stringValue": "" } } }, "limit": 1 }}
I GET IN API EXPLORER A SUCCESS:
200 OK
- Show headers -
{ "0": { "document": { "name": "projects/.../databases/(default)/documents/Instances/00cn9FErQYxGujvLjXy5", "createTime": "2019-01-20T21:33:43.894843Z", "updateTime": "2019-01-20T23:43:15.550880Z" }, "readTime": "2019-01-23T00:17:22.240725Z" }}
But when posting using wix- getJson in backend:
getJSON(“https://firestore.googleapis.com/v1beta1/projects/.../databases/(default)/documents:runQuery?appid={MY_KEY}”,{ method: ‘post’ , headers: { ‘Content-Type’: ‘application/json’ }, body: {“structuredQuery”: {“select”: {“fields”: },“from”: [{“collectionId”: “Instances”}],“where”: {“fieldFilter”: {“field”: {“fieldPath”: “Occupied”},“op”: “EQUAL”,“value”: {“stringValue”: “”}}},“limit”: 1}}})
I don’t get anything. It looks like nothing happens. I don’t get any response event or there are late exception responses I can’t connect to that.
I could not find no good answers in your API documentation that show how to do it right.
Thanks beforehand
Shlomi