sudhanshu shaurya
sudhanshu shaurya

Reputation: 235

How to get firestore data without using firebase library

I am new in using firestore .I am working on a project where new requirement came as i have to fetch data from firestore.But the problem is my server is of old version where i can not install any firebase packages due to older version of server .How can i bypass installing firebase packages. i tried to get data from api as

https://firestore.googleapis.com/v1/projects/$FirebaseProjectId/databases/(default)/documents/$path/?key=

but the format i am receiveing data is complex as below

"name": "projects/$ProjectId/databases/(default)/documents/$path", "fields": { "Key1": { "stringValue": "Value!" }, "Key2": { "stringValue": "Value2" }, "Key3": { "stringValue": "value3" },

This String value and other data type is creating problem i want this data in simple json or Map<key,value format> I have all the firebase access like apiKey and other credentials if required how can i get that Thanks

Upvotes: 0

Views: 192

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83103

I understand that you use a server that cannot support one of the Firestore Admin SDKs.

AFAIK the only way to interact from your server with a Firestore Database apart from using the Admin SDK is by using the Firestore REST API.

Yes the responses from the REST APIs have somehow a "cumbersome" format but it is not that difficult to extract the field values, you just need to know the types of the different fields and manage the cases where some fields are not present in the response.


Note that this answer is also valid for the Client SDKs: If you cannot use a Client SDK from a client app, you have to use the REST API. The Admin and Client SDKs add a layer on top of the REST API which makes it much easier to use.

Upvotes: 1

Related Questions