任务 API

所有任务
GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/
任务列表的任务
GET /portal/[PORTALID]/projects/[PROJECTID]/tasklists/[TASKLISTID]/tasks/
任务详情
GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/
创建任务
POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/
更新任务
POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/
删除任务
DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/
创建任务
POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/subtasks/
获取子任务
GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/subtasks/
获取评论
GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/
添加评论
POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/
更新评论
POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/[COMMENTID]/
删除评论
DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/[COMMENTID]/
获取任务附件
GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/attachments/
删除任务附件
DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/attachments/[ATTACHMENTID]/
获取所有任务布局
GET /portal/[PORTALID]/tasklayouts/
获取任务布局详情
GET /portal/[PORTALID]/projects/[PROJECTID]/tasklayouts/

 所有任务

GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/

获取给定项目中的所有任务。它只提取子主任务,并不提取子任务。

请求参数

索引整数型任务的索引号。
范围整数型

任务的范围。

所有者字符串或长整型

任务的所有者必须为全部或用户 ID。

全部 - 字符串,用户 ID - 长整型)

状态字符串任务的状态必须为全部已完成未完成
时间字符串任务的时间期必须为全部逾期今天明天
优先级字符串任务的优先级必须为全部
tasklist_id长整型任务列表的 ID。
custom_status长整型自定义任务状态的 ID。示例:932200000000277068.

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
"tasks": [
{
"id": 170876000000270080,
"name": "Ledger",
"completed": true,
"created_by": "2060758",
"created_person": "Patricia Boyle",
"priority": "High",
"percent_complete": 100,
"start_date": "01-14-2011 12:00 AM",
"start_date_long": 1294972200000,
"end_date": "01-24-2011 12:00 AM",
"end_date_long": 1295836200000,
"custom_fields": [{
            "column_name": "UDF_CHAR1",
            "label_name": "My_date",
            "value": "Custom field example"
        }],
"dependency": {
"successor": [
"1234567899876543201"
],
"predecessor": [
"1239857339384756943"
]
},
"duration": "11",
"details": {
"owners": [
{
"name": "Amritha Agrawal",
"id": "2063270"
}
]
},
"link": {
"self": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000000270067/"
},
"timesheet": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000000270067/logs/"
}
},
"tasklist": {
"id": 170876000000270050,
"name": "ERP Phase III"
},
"status": {
            "name": "Open",
            "id": "4000000000335",
            "type": "open",
            "color_code": "#eb5768"
            }
}
]
}

 任务列表的任务

GET /portal/[PORTALID]/projects/[PROJECTID]/tasklists/[TASKLISTID]/tasks/

获取给定任务列表中的所有任务。

请求参数

索引整数型任务的索引号。
范围整数型任务的范围。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "tasks": [{
        "id": 170876000001217298,
        "name": "Fix review comments by SME",
        "completed": true,
        "created_by": "2060758",
        "created_person": "Patricia Boyle",
        "priority": "None",
        "percent_complete": 100,
        "start_date": "09-30-2013 12:00 PM",
        "start_date_long": 1380551400000,
        "end_date": "10-04-2013 09:00 PM",
        "end_date_long": 1380929400000,
        "duration": "49",
        "details": {
            "owners": [{
                "name": "Unassigned"
            }]
        },
        "link": {
            "self": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000000147021/tasks/170876000001217298/"
            },
            "timesheet": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000000147021/tasks/170876000001217298/logs/"
            }
        }
    }]
}

 任务详情

GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/

获取任务的所有详情。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "tasks": [{
        "id": 170876000001217306,
        "name": "Send for language  review",
        "completed": false,
        "created_by": "2060758",
        "created_person": "Patricia Boyle",
        "priority": "None",
        "percent_complete": 50,
        "start_date": "04-15-2014 10:00 AM",
        "start_date_long": 1397565000000,
        "end_date": "04-24-2014 07:00 PM",
        "end_date_long": 1398375000000,
        "dependency":{
        "successor":["1234567899876543201"],
        "predecessor":["1239857339384756943"]
         },
        "duration": "8",
        "details": {
            "owners": [{
                "name": "Einhard Klein",
                "id": "2060761"
            }]
        },
        "link": {
            "self": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000000147021/tasks/170876000001217306/"
            },
            "timesheet": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000000147021/tasks/170876000001217306/logs/"
            }
        }
    }]
}

 创建任务

POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/

创建任务。

请求参数

person_responsible长整型任务的所有者 ID。对于多个用户,用户 ID 必须用逗号分隔。
tasklist_id长整型任务列表的 ID。
名称*字符串任务的名称。
start_date字符串 [MM-DD-YYYY]任务的开始日期。
end_date字符串 [MM-DD-YYYY]任务的结束日期。
持续时间 整数型任务的持续时间。
duration_type字符串任务类型的持续时间,以小时计。
优先级(无、低、中、高)字符串任务的优先级必须为
描述字符串任务的描述。
uploaddoc文件对任务添加文件。
start_time字符串开始时间可指定为 12 小时或 24 小时格式。例如:上午 01:0013:00
end_time字符串结束时间可指定为 12 小时或 24 小时格式。例如:下午 09:0021:00
owner_workJSON 数组user_id 和 working_hours 必须在数组中提供以对任务所有者分配工作小时数。[{"user_id":"xxxxxx","working_hours":"2"}]
work_type字符串分配 work_hrs_per_daywork_in_percentagework_hours
custom_fieldsJSON 对象示例:{“UDF_CHAR1”:”Hello”}

 

样本响应

Status: 201 Created

Content Type: application/json;charset=utf-8
{
"tasks": [
{
"id": 170876000001849020,
"name": "Fix QA comments",
"completed": false,
"created_by": "2060758",
"created_person": "Patricia Boyle",
"priority": "None",
"percent_complete": 0,
"custom_fields": [{
            "column_name": "UDF_DATE1",
            "label_name": "My_date",
            "value": "11-11-2017 12:00:00 AM"
            }],
"details": {
"owners": [
{
"name": "Unassigned"
}
]
},
"link": {
"self": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000001849039/"
},
"timesheet": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000001849039/logs/"
}
},
"status": {
            "name": "Open",
            "id": "4000000000335",
            "type": "open",
            "color_code": "#eb5768"
            }
}
]
}

 更新任务

POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/

更新给定项目中的任务。

请求参数

person_responsible*长整型任务的所有者 ID。对于多个用户,用户 ID 必须用逗号分隔。
名称*字符串任务的名称。
start_date字符串 [MM-DD-YYYY]任务的开始日期。
end_date字符串 [MM-DD-YYYY]任务的结束日期。
percent_complete整数型任务完成百分比必须为 10 的倍数。[10 至 100]
持续时间整数型任务的持续时间。
duration_type字符串任务类型的持续时间,以小时计。
优先级(无、低、中、高) 字符串任务的优先级必须为
描述字符串任务的描述。
start_time字符串开始时间可指定为 12 小时或 24 小时格式。例如:上午 01:0013:00
end_time字符串结束时间可指定为 12 小时或 24 小时格式。例如:上午 01:0013:00
owner_workJSON 数组user_id 和 working_hours 必须在数组中提供以对任务所有者分配工作小时数。
work_type字符串分配 work_hrs_per_daywork_in_percentagework_hours
task_duration_as_work字符串如果值为 true,则分配整个任务持续时间作为任务所有者的工作小时数
uploaddoc文件对任务添加文件。
custom_fieldsJSON 对象示例:{"UDF_CHAR1":"Hello"}
custom_status长整型自定义任务状态的 ID。示例:932200000000277068

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
"tasks": [
{
"id": 170876000001849020,
"name": "Fix QA comments",
"completed": false,
"created_by": "2060758",
"created_person": "Patricia Boyle",
"priority": "None",
"percent_complete": 0,
"custom_fields": [{
            "column_name": "UDF_DATE1",
            "label_name": "My_date",
            "value": "11-11-2017 12:00:00 AM"
            }],
"details": {
"owners": [
{
"name": "Unassigned"
}
]
},
"link": {
"self": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000001849039/"
},
"timesheet": {
"url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/ 170876000000147021/tasks/170876000001849039/logs/"
}
},
"status": {
            "name": "Open",
            "id": "4000000000335",
            "type": "open",
            "color_code": "#eb5768"
            }
}
]
}

 删除任务

DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/

删除给定项目中的任务。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "response": "Task Deleted Successfully"
}

 创建子任务

POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/subtasks/

创建子任务。

请求参数

person_responsible长整型任务的所有者 ID。对于多个用户,用户 ID 必须用逗号分隔。
名称*字符串任务的名称。
start_date字符串 [MM-DD-YYYY]任务的开始日期。
end_date字符串 [MM-DD-YYYY]任务的结束日期。
持续时间整数型任务的持续时间。
duration_type字符串任务类型的持续时间,以小时计。
优先级(无、低、中、高)字符串任务的优先级必须为
描述字符串任务的描述。
custom_fieldsJSON 对象示例:{“UDF_CHAR1”:”Hello”}

样本响应

Status: 201 Created

Content Type: application/json;charset=utf-8
{
  "tasks": [{
  "created_by": "2060758",
  "created_time_long": 1451974141000,
  "subtasks": false,
  "link": {
  "self": {
  "url": "https://projectsapi.zoho.com/restapi/portal/zillum/projects/
   170876000001865067/tasks/170876000002969005/"
  },
  "timesheet": {
  "url": "https://projectsapi.zoho.com/restapi/portal/zillum/projects/
   170876000001865067/tasks/170876000002969005/logs/"
  }
  },
  "depth": 1,
  "last_updated_time_format": "01-04-2016 10:09:01 PM",
  "last_updated_time_long": 1451974141000,
  "id": 170876000002969005,
  "percent_complete": "0",
  "created_person": "Patricia Boyle",
  "last_updated_time": "01-04-2016",
  "details": {
  "owners": [{
  "name": "Unassigned"
  }]
  },
  "id_string": "170876000002969005",
  "priority": "None",
  "name": "Blog Image",
  "created_time_format": "01-04-2016 10:09:01 PM",
  "created_time": "01-04-2016",
  "completed": false
  }]
}

 获取子任务

GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/subtasks/

获取给定任务的所有子任务。

请求参数

索引整数型子任务的索引号。
范围整数型子任务的范围。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "tasks": [{
        "created_by": "2060758",
        "subtasks": false,
        "start_date_long": 1408365000000,
        "link": {
            "self": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000001865067/tasks/170876000001868770/"
            },
            "timesheet": {
                "url": "https://projectsapi.zoho.com/restapi/portal/2063927/projects/
                        170876000001865067/tasks/170876000001868770/logs/"
            }
        },
        "tasklist": {
            "id": 170876000001868599,
            "name": "ERP Phase III"
        },
        "depth": 1,
        "end_date_format": "08-19-2014 06:30 AM",
        "id": 170876000001868770,
        "percent_complete": "60",
        "duration": "2",
        "created_person": "Boyle Patricia",
        "end_date": "08-19-2014",
        "details": {
            "owners": [{
                "id": "2060556",
                "name": "Hiyoshi Nakano"
            }, {
                "id": "2060755",
                "name": "Manish Patel"
            }]
        },
        "priority": "None",
        "name": "Work on Finance Budget for this month",
        "end_date_long": 1408483800000,
        "start_date_format": "08-17-2014 09:30 PM",
        "start_date": "08-17-2014",
        "completed": false
    }]
}

 获取评论

GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/

获取所有任务评论。

请求参数

索引整数型任务评论的索引号。
范围整数型任务评论的范围。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "comments": [{
        "content": "Projects",
        "id": 57000001124005,
        "created_time_long": 1408625664048,
        "added_by": "2060758",
        "added_person": "Boyle Patricia",
        "created_time_format": "08-20-2014 09:54 PM",
        "created_time": "08-20-2014"
    }, {
        "content": "Check with Sales team",
        "id": 57000001153001,
        "created_time_long": 1411755818829,
        "added_by": "2060758",
        "added_person": "Boyle Patricia",
        "created_time_format": "09-26-2014 03:23 AM",
        "created_time": "09-26-2014"
    }]
}

 添加评论

POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/

添加任务评论。

请求参数

内容*字符串 任务的评论。

样本响应

Status: 201 Created

Content Type: application/json;charset=utf-8
{
    "comments": [{
        "content": "Setup Demo Video",
        "id": 57000001149011,
        "created_time_long": 1411756962722,
        "added_by": "2060758",
        "added_person": "Boyle Patricia",
        "created_time_format": "09-26-2014 03:42 AM",
        "created_time": "09-26-2014"
    }]
}

 更新评论

POST /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/[COMMENTID]/

更新任务评论的描述。

请求参数

内容*字符串任务的评论。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "comments": [{
        "content": "Setup Demo Video",
        "id": 57000001149011,
        "created_time_long": 1411756962722,
        "added_by": "2060758",
        "added_person": "Boyle Patricia",
        "created_time_format": "09-26-2014 03:42 AM",
        "created_time": "09-26-2014"
    }]
}

 刪除评论

DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/comments/[COMMENTID]/

删除任务评论。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "response": "Comment Deleted Successfully"
}

 获取任务附件

GET /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/attachments/

检索与任务相关的附件的详情。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
[{
    "CONTENT_TYPE": "pdf",
    "AUTHOR_ID": "565296969",
    "THUMBNAIL_URL": "https://download.zoho.com/paramdownloadservlet?x-service=EX&x-encoding=gzip&x-mode=2&x-resource_id=033zqca7d98669ef541348a5d2ded5d44ff3d&event-id=033zqca7d98669ef541348a5d2ded5d44ff3d_350x262&x-w=350&x-h=262",
    "FILENAME": "mybook.pdf",
    "UPLOADED_TIME": 1476939840136,
    "DOWNLOAD_URL": "https://download.zoho.com/paramdownloadservlet?x-service=EX&event-id=033zqca7d98669ef541348a5d2ded5d44ff3d_1476939885220&x-encoding=gzip&x-resource_id=033zqca7d98669ef541348a5d2ded5d44ff3d",
    "RESOURCE_ID": "033zqca7d98669ef541348a5d2ded5d44ff3d",
    "OWNER": "Boyle Patricia"
}]

 删除任务附件

DELETE /portal/[PORTALID]/projects/[PROJECTID]/tasks/[TASKID]/attachments/[ATTACHMENTID]/

删除与任务相关联的附件。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
     "response": "Task Document Deleted Successfully"
}

获取所有任务布局

GET /portal/[PORTALID]/tasklayouts

查看门户中可用的所有任务的列表。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8
{
    "layouts": [{
        "layout_name": "CustomizedLayout",
        "layout_id": "932200000000304001",
        "is_default": false
    }, {
        "layout_name": "Standard Layout",
        "layout_id": "932200000000277011",
        "is_default": true
    }]
}
    }]
}

获取任务布局详情

GET /portal/[PORTALID]/projects/[PROJECTID]/tasklayouts

在必要时提取任务布局的详情。

样本响应

Status: 200 Success

Content Type: application/json;charset=utf-8

{
    "layout_id": "932200000000304001",
    "section_details": [{
        "section_name": "Task Information",
        "customfield_details": [{
            "column_name": "LOGINNAME",
            "is_mandatory": false,
            "is_default": true,
            "display_name": "Owner",
            "column_type": "userpicklist"
        }, {
            "column_name": "CUSTOM_STATUSID",
            "is_mandatory": false,
            "is_default": true,
            "display_name": "Status",
            "column_type": "picklist"
        }, {
            "column_name": "PRIORITY",
            "is_mandatory": false,
            "is_default": true,
            "display_name": "Priority",
            "column_type": "picklist"
        }, {
            "column_name": "PERCENTCOMPLETE",
            "is_mandatory": false,
            "is_default": true,
            "display_name": "Percentcomplete",
            "column_type": "singleline"
        }],
        "is_default": false
    }, {
        "section_name": "New Section",
        "customfield_details": [{
            "column_name": "UDF_CHAR1",
            "is_mandatory": false,
            "is_default": false,
            "display_name": "My_Field",
            "column_type": "singleline"
        }, {
            "column_name": "UDF_DATE1",
            "is_mandatory": false,
            "is_default": false,
            "display_name": "My_Date",
            "column_type": "date"
        }],
        "is_default": false
    }],
    "status_details": [{
        "is_start": true,
        "color": "#eb5768",
        "name": "Open",
        "id": "932200000000277068",
        "is_default": true,
        "type": "open"
    }, {
        "is_start": false,
        "color": "#8eb15a",
        "name": "Closed",
        "id": "932200000000277071",
        "is_default": true,
        "type": "closed"
    }, {
        "is_start": false,
        "color": "#935b1a",
        "name": "To be Tested",
        "id": "932200000000345019",
        "is_default": false,
        "type": "open"
    }]
}
    }]
}