How to work with Realtime 'get' and 'update' api requests?

与世无争的帅哥 提交于 2019-12-20 03:19:46

问题


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.



来源:https://stackoverflow.com/questions/19641496/how-to-work-with-realtime-get-and-update-api-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!