I'm doing a GET
call in this link:
https://firestore.googleapis.com/v1/projects/{projectID}/databases/(default)/documents/
users/testers?key={MY_KEY}&fields=fields&mask.fieldPaths=ID
The answer it returns is:
{
"fields": {
"ID": {
"stringValue": "1"
}
}
}
How can I change the link to get only 1
(or {1}
) as answer from my GET?
[Firebaser here] that's not possible using the REST API. Firestore documents cannot be encoded as simple JSON objects since some types, such as advanced numeric types or DocumentReference
, would be ambiguous when converted to strings or numbers.
Therefore the REST API encodes each field as a key-value pair with the type as the key.
The Firestore SDKs (which are available for most platforms) decode this for you and give you platform-native types.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.