NodeJS GoogleAPIs镜像时间轴插入返回400代码与“必需”

NodeJS GoogleAPIs镜像时间轴插入返回400代码与“必需”

问题描述:

我想发送一个非常简单的Hello World消息到NodeJS与googleapis包版本1.0.20的镜像API时间线,但我得到回应不是很有帮助。NodeJS GoogleAPIs镜像时间轴插入返回400代码与“必需”

// OAuth is happening earlier and creating the proper auth tokens 
googleapis.options({ auth: oAuth2Client }); 

mirror = googleapis.mirror('v1'); 
// This works fine and gives me a list of my current timeline 
mirror.timeline.list({}, function(err, data) {console.log(err); console.log(data);}) 

// This results in an error 
mirror.timeline.insert({'text':'Hello World'}, function(err, data) {console.log(err); console.log(data);}) 

我看到的错误是:

{ errors: [ { domain: 'global', reason: 'required', message: 'Required' } ], 
    code: 400, 
    message: 'Required' } 

我发现,看到同样的响应一些其他的问题,他们都错过输入,但我错过了哪个输入?

检查的代码文件后,看来你需要用正常参数的“资源”:

// This works! 
mirror.timeline.insert({'resource':{'text':'Hello World'}}, function(err, data) {console.log(err); console.log(data);}) 
+0

救星,把我的2个小时的时间处理这一点。 – ArniReynir 2014-12-29 14:47:45