目的
此 API 用于检索工作列表、工作详细信息,添加、修改、删除工作,检查添加工作权限,以及更改工作状态。
获取工作 API
此 API 用于获取工作列表。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/getjobs?authtoken=<authtoken>&assignedTo=<assignedTo>&assignedBy= <assignedBy>&projectId=<projectId >&dateFormat=<dateFormat>&jobStatus =<jobStatus >
请求参数:
authtoken |
指定身份验证令牌 |
assignedTo |
指定全部 ID 或员工记录编号或邮箱地址或员工 ID |
assignedBy |
指定全部 ID 或员工记录编号或邮箱地址或员工 ID |
jobStatus |
指定全部或正在进行中或已完成 |
projectId |
指定项目 ID |
dateFormat |
指定日期格式 |
示例 URL:
http://people.zoho.com.cn/people/api/timetracker/getjobs?authtoken=<authtoken>&assignedTo=1&assignedBy=1&jobStatus=all
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri=”/people/api/timetracker/getjobs">
<status>0</status>
<message>Data Fetched Successfully</message>
<result>
<job>
<jobId>233118000000126031</jobId>
<jobName>Web Designing</jobName>
<assignedBy>Charles Stones</assignedBy>
<hours>22:30<hours >
<description>The design is to be done with CSS3</description >
<fromDate>13-MAR-2014</fromDate>
<toDate>17-MAR-2014</toDate>
<projectId>41104000000768001</projectId>
<projectName>Wray Group</projectName>
<ratePerHour>13</ratePerHour>
<assignees>
<assignee>
<name>Patricia Boyle</name>
<hours>12:30</hours>
</assignee>
<assignee>
<name>Jasmine Frank</name>
<hours>10:00</hours>
</assignee>
</assignees>
</job>
<job>
<jobId>233118000000126047</jobId>
<jobName>Product Video</jobName>
<assignedBy>Charles Stones</assignedBy>
<hours>18:00<hours >
<description>Should include latest facilities</description >
<fromDate>19-MAY-2014</fromDate>
<toDate>22-MAY-2014</toDate>
<projectId>270127000000042883</projectId>
<projectName>AM Associates</projectName>
<ratePerHour>13</ratePerHour>
<assignees>
<assignee>
<name>Charles Stones</name>
<hours>6:00</hours>
</assignee>
<assignee>
<name>Jasmine Frank</name>
<hours>6:00</hours>
</assignee>
<assignee>
<name>Eduardo Vargas</name>
<hours>6:00</hours>
</assignee>
</assignees>
</job>
</result>
</response>
JSON 响应:
{"response":{ uri:"/people/api/timetracker/getjobs", "status":0, "message":"Data Fetched Successfully", "result":{ "job":[ { "jobId":"233118000000126031", "jobName":"Web Designing", "assignedBy":"Charles Stones", "hours":"22:30", "description":"The design is to be done with CSS3", "fromDate":"13-MAR-2014", "toDate":"17-MAR-2014", "projectId":"41104000000768001", "projectName":"Wray Group", "ratePerHour":13, "assignees":{[ {"name":"Patricia Boyle","hours":"12:30"}, {"name":"Jasmine Frank","hours":"10:00"} ]} }, { "jobId":"233118000000126047", "jobName":"Product Video", "assignedBy":"Charles Stones", "hours":"18:00", "description":"Should include latest facilities", "fromDate":"19-MAY-2014", "toDate":"22-MAY-2014", "projectId":"270127000000042883", "projectName":"AM Associates", "ratePerHour":13, "assignees":{[ {"name":"Charles Stones","hours":"6:00"}, {"name":"Jasmine Frank","hours":"6:00"}, {"name":"Eduardo Vargas","hours":"6:00"} ]} } ] } } }
获取工作详情 API
此 API 用于获取工作详细信息列表。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/getjobdetails?authtoken=<authtoken>&jobId=<jobId>&dateFormat=<dateFormat>
请求参数:
authtoken |
指定身份验证令牌 |
jobId |
指定工作 ID |
dateFormat |
指定日期格式 |
示例 URL:
http://people.zoho.com.cn/people/api/timetracker/getjobdetails?authtoken=48a1a3be24d98d11d53778200a4758c2&jobId=177402000000814321
XML 响应:
<response uri="/api/timetracker/getjobdetails">
<status>0</status>
<message>Data Fetched Successfully</message>
<result>
<job>
<totalhours>04:00</totalhours>
<fromDate>2015-02-11</fromDate>
<jobId>177402000000814321</jobId>
<jobStatus>In-Progess</jobStatus>
<hours>49:00</hours>
<owner>177402000000034203</owner>
<assignedBy>Karan</assignedBy>
<toDate>2015-02-11</toDate>
<jobName>Documentation</jobName>
<ratePerHour>0.0</ratePerHour>
<assignees>
<assignee>
<erecno>177402000000034203</erecno>
<hours>00:00</hours>
<name>Karan</name>
</assignee>
<assignee>
<erecno>177402000000037563</erecno>
<hours>13:00</hours>
<name>Johny</name>
</assignee>
<assignee>
<erecno>177402000000663330</erecno>
<hours>12:00</hours>
<name>Mackay</name>
</assignee>
<assignee>
<erecno>177402000000663414</erecno>
<hours>12:00</hours>
<name>Sturgess</name>
</assignee>
</assignees>
</job>
</result>
</response>
JSON 响应:
{ "response": { "message": "Data Fetched Successfully", "result": [ { "totalhours": "04:00", "fromDate": "2015-02-11", "jobId": "177402000000814321", "assignees": [ { "erecno": "177402000000034203", "hours": "00:00", "name": "Karan" }, { "erecno": "177402000000037563", "hours": "13:00", "name": "Johny" }, { "erecno": "177402000000663330", "hours": "12:00", "name": "Mackay" }, { "erecno": "177402000000663414", "hours": "12:00", "name": "Sturgess" } ], "jobStatus": "In-Progess", "hours": "49:00", "owner": "177402000000034203", "assignedBy": "Karan", "toDate": "2015-02-11", "jobName": "Documentation", "ratePerHour": 0 } ], "status": 0, "uri": "/api/timetracker/getjobdetails" } }
添加工作权限 API
此 API 用于为任何特定工作添加工作权限。
请求 URL:
https://people.zoho.com.cn/api/timetracker/addjobpermissioncheck?authtoken=<token>
请求参数:
示例 URL:
https://people.zoho.com.cn/api/timetracker/addjobpermissioncheck?authtoken=48a1a3be24d98d11d53778200a4758c2
XML 响应:
<response uri="/api/timetracker/addjobpermissioncheck">
<status>0</status>
<message>Add Job permission fetched successfully</message>
<result>
<isAllowed>true</isAllowed>
</result>
</response>
JSON 响应:
{ "response": { "message": "Add Job permission fetched successfully", "result": { "isAllowed": true }, "status": 0, "uri": "/api/timetracker/addjobpermissioncheck" } }
添加工作 API
此 API 用于为员工添加和分配工作。
请求 URL:
https://people.zoho.com.cn/api/timetracker/addjob?authtoken=<token>&jobName=<jobName>&assignedTo=<assignedTo>&assignees=<assignees>&dateFormat=<dateFormat>&hours=<hours>&description=<description>&fromDate=<fromDate>&toDate=<toDate>&projectId=<projectId>&ratePerHour=<ratePerHour>
请求参数:
authtoken |
指定身份验证令牌 |
jobName |
指定工作名称 |
assignedTo |
为单个员工指定员工记录编号或邮箱地址或员工 ID |
assignees |
[{'assignedTo':< ERECNO | Email-ID | Employee-ID >,'hours':'value'} ..... n for the multiple employees] |
dateFormat |
指定日期格式 |
hours |
指定小时数 |
description |
指定描述 |
fromDate |
指定起始日期 |
toDate |
指定截止日期 |
projectId |
指定项目 ID |
ratePerHour |
指定每小时的费率 |
示例 URL:
https://people.zoho.com.cn/api/timetracker/addjob?authtoken=48552851f39b2455991e8eeab1a67d80&jobName=API job&assignedTo=293141000000061007&hours=2&description=desc&fromDate=2015-05-10&toDate=2015-05-10&projectId=293141000000065149&ratePerHour=2
XML 响应:
<response uri="/api/timetracker/addjob">
<status>0</status>
<message>Job added Successfully</message>
<result>
<jobId>293141000000144015</jobId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Job added Successfully", "result": [ { "jobId": "293141000000144027" } ], "status": 0, "uri": "/api/timetracker/addjob" } }
针对添加工作的基于表单的 API
此 API 在工作表单中存在自定义字段时使用。
请求 URL:
https://people.zoho.com.cn/people/api/forms/<inputType>/<formLinkName>/insertRecord?authtoken=<token>&inputData=<inputData>
请求参数
authtoken |
指定身份验证令牌 |
inputType |
xml 或 json |
inputData |
XML 输入:<Request><Record><field name="Labelname">value</field><field name="LabelName1">value1</field><field name="Labelname2">value2</field></Record></Request>
JSON input: {LabelName:'value',LabelName1:'value1',LabelName2:'value2'} |
示例 URL:
https://people.zoho.com.cn/people/api/forms/json/P_TimesheetJob/insertRecord?authtoken=a2aeec6f871980204791008133b2deb7&inputData={Job_Name:'Components Design',StartDate:'10-Jul-2015',Project:'173907000000744045',Assignees:'173907000000181083;173907000000144215;173907000000034203',AssigneeHours:'5;4;6',RatePerHour:'15',First_Review_Date:'24-Jul-2015',Job_Coordinator:'173907000000144215'}
XML 响应
<?xml version=""1.0"" encoding=""UTF-8""?> <response uri=""/api/forms/xml/P_TimesheetJob/insertRecord""> <status> 0</status> <message> Data added successfully</message> <result> <message> Successfully Added</message> </result> </response>
JSON 响应
{"response":{"message":"Data added successfully","result":{"message":"Successfully Added"},"status":0,"uri":"/api/forms/json/P_TimesheetJob/insertRecord"}}
注:
- 请参阅 https://people.zoho.com.cn/people/#admin/api/reference 或使用提取组件 API 来获取表单组件的列表。
- 对于编辑操作,使用 recordId 和 inputData。
- 要向所有用户分配工作,请在 inputData 中将“Assignees”设置为“All”。
- 要设置受托人的小时数,请使用“AssigneeHours”键。小时数之间应使用分号隔开。
修改工作 API
此 API 用于修改任何工作。
请求 URL:
https://people.zoho.com.cn/api/timetracker/modifyjob?authtoken=<token>&jobId=<jobId>&assignedTo=<assignedTo>&hours=<hours>&description=<description>&fromDate=<fromDate>&toDate=<toDate>&projectId=<projectId>&ratePerHour=<ratePerHour>
请求参数:
authtoken |
指定身份验证令牌 |
jobId |
指定工作 ID |
assignedTo |
为单个员工指定员工记录编号或邮箱地址或员工 ID |
hours |
指定小时数 |
description |
指定描述 |
fromDate |
指定起始日期 |
toDate |
指定截止日期 |
projectId |
指定项目 ID |
ratePerHour |
指定每小时的费率 |
示例 URL:
https://people.zoho.com.cn/api/timetracker/modifyjob?authtoken=48552851f39b2455991e8eeab1a67d80&jobId=177402000000814321 &assignedTo=293141000000061007&hours=2&description=desc&fromDate=2015-05-10&toDate=2015-05-10&projectId=293141000000065149&ratePerHour=2
XML 响应:
<response uri="/api/timetracker/modifyjob">
<status>0</status>
<message>Job modified Successfully</message>
<result>
<jobId>293141000000144015</jobId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Job modified Successfully", "result": [ { "jobId": "293141000000144027" } ], "status": 0, "uri": "/api/timetracker/modifyjob" } }
更改工作状态 API
此 API 用于更改工作状态。
请求 URL:
https://people.zoho.com.cn/people/api/timetracker/modifyjobstatus?authtoken=<token>&jobId=<jobId>&jobStatus=<jobStatus>
请求参数:
authtoken |
指定身份验证令牌 |
jobId |
指定工作 ID |
jobStatus |
指定工作状态为正在进行中或已完成 |
示例 URL:
https://people.zoho.com.cn/api/timetracker/modifyjobstatus?authtoken=48552851f39b2455991e8eeab1a67d80&jobId=177402000000814321 &jobStatus=completed
XML 响应:
<response uri="/api/timetracker/modifyjobstatus">
<status>0</status>
<message>Job status modified Successfully</message>
<result>
<jobId>293141000000144015</jobId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Job status modified Successfully", "result": [ { "jobId": "293141000000144027" } ], "status": 0, "uri": "/api/timetracker/modifyjobstatus" } }
删除工作 API
此 API 用于删除任何工作。
请求 URL:
https://people.zoho.com.cn/people/api/timetracker/deletejob?authtoken=<token>&jobId=<jobId>
请求参数:
authtoken |
指定身份验证令牌 |
jobId |
指定工作 ID(用逗号分隔) |
示例 URL:
https://people.zoho.com.cn/api/timetracker/deletejob?authtoken=48552851f39b2455991e8eeab1a67d80&jobId=177402000000814321
XML 响应:
<response uri="/api/timetracker/deletejob">
<status>0</status>
<message>Job deleted Successfully</message>
<result>
<jobId>293141000000144015</jobId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Job deleted Successfully", "result": [ { "jobId": "293141000000144027" } ], "status": 0, "uri": "/api/timetracker/deletejob" } }