Google任务更新错误 [英] Google tasks update error

查看:332
本文介绍了Google任务更新错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用以下代码更新任务:



I am attempting to update a task with the following code:

function updtsk(task,id)
{
  var url = 'https://www.googleapis.com/tasks/v1/lists/@default/tasks/'+id;
  var req = {
    'method': 'PUT',
    'headers': {
      'Content-type': 'application/json'
    },
    'body': JSON.stringify(task)
  };
  var addDone = function(resp, xhr) {
    if (xhr.status != 200) {
      notifyFailure('Couldn\'t update task.', xhr.status);
      return;
    }

    //notifySuccess(task['title']);
  }

  oauth.sendSignedRequest(url, addDone, req);
}

然而,我得到以下错误:

I get the following error however:

"{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "Invalid Value"
   }
  ],
  "code": 400,
  "message": "Invalid Value"
 }
}
"



更新机构是这样的:

The update body is this:

{
 'title': $(this).val()
};

我使用chrome_ex_oauth api并可以使用一些帮助。

I am using the chrome_ex_oauth api and could use some help.

推荐答案

可能需要在更新中包含其他字段。

It's possible you need to include additional fields in the update.

此处的文档: http://code.google.com/apis/tasks/v1/reference.html#resource_tasks 会显示状态属性不是可选的(其他可变字段已列出在他们的描述中是可选的)。您可能还需要包含属性和指定的静态值。

The documentation here: http://code.google.com/apis/tasks/v1/reference.html#resource_tasks appears to indicate the status property is not optional (the other mutable fields are listed as optional in their descriptions). You may also need to include the kind property with the static value indicated there.

这篇关于Google任务更新错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆