How to work with Realtime 'get' and 'u

2019-02-27 15:18发布

问题:

I am trying to understand how the Realtime API Resource Model is "shaped", in order to work with 'get' and 'update' features. Unfortunately documentation doesn't not say nothing about it (https://developers.google.com/drive/v2/reference/realtime#resource).

I went to try by myself using the 'get' request provided in the docs (https://developers.google.com/drive/v2/reference/realtime/get#try-it), so I created a new one realtime doc (using the Google Drive Realtime API Playground) and I passed the fileId to the 'get' request. What I am getting back, in the response body, is a base64 content in which (once decoded) the data field is always null:

{"appId":"0123456789","revision":1,"data":null}

Is there any way to get these API working ?

Thanks in advance

回答1:

You can't use the "try it" helper to play with this feature, unfortunately. A realtime model is associated with a particular app. When you create a doc in the realtime playground, it is owned by the realtime playground app. When you try to then "get" the response in the "try-it" feature, it uses an app specific to "try-it" which can't see the realtime model you created.

If you do a "get" with the same app that created the realtime model, you should see that "data" is a json representation of the data model.

We'll work on getting this better documented.