Can firebase server timestamps be written without two requests?

The Firebase REST API describes how to write server values (currently only timestamps are supported), but it seems like a separate request needs to be sent to do this. Is there (or was it planned) a way to set timestamps (like createdAt) at the same time you send other data? It looks like this will actually help reduce traffic and improve performance.


source to share

1 answer

Of course it is possible. The documentation is admittedly a bit unclear, but all you have to do is include the object {".sv": "timestamp"}

as part of your JSON payload. Here's an example that saves it to the key timestamp


curl -X PUT -d '{"something":"something", "timestamp":{".sv": "timestamp"}}'



All Articles