项目 API
目的
此 API 用于获取项目列表,以及用于添加、修改、更改项目状态和删除项目。
获取项目 API
此 API 用于获取项目列表。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/getprojects?authtoken=<authtoken>&clientId=<clientId>&projectStatus=<projectStatus>
请求参数:
authtoken | 指定身份验证令牌 |
clientId | 指定客户 ID |
projectStatus | 指定项目状态为正在进行中或已完成或全部 |
示例 URL:
http://people.zoho.com.cn/api/timetracker/getprojects?authtoken=2110c57f48434f76c22c139c6ef88926&clientId=2239000000332107&projectStatus=all
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri="/api/timetracker/getprojects">
<status>0</status>
<message>List of Projects fetched successfully</message>
<result>
<project>
<projectStatus>In-Progress</projectStatus>
<ownerName>Guru F Guru L</ownerName>
<projectCost>0.0</projectCost>
<ownerId>2239000000048003</ownerId>
<clientName>Google client</clientName>
<projectId>2239000000328227</projectId>
<jobIdList>[]</jobIdList>
<projectName>testproject</projectName>
<clientId>2239000000332107</clientId>
</project>
</result>
</response>
JSON 响应:
{ "response": { "message": "List of Projects fetched successfully", "result": [ { "projectStatus": "In-Progress", "ownerName": "Guru F Guru L", "projectCost": 0, "ownerId": "2239000000048003", "clientName": "Google client", "projectId": "2239000000328227", "jobIdList": [], "projectName": "testproject", "clientId": "2239000000332107" } ], "status": 0, "uri": "/api/timetracker/getprojects" } }
添加项目 API
此 API 用于添加项目。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/addproject?authtoken=<authtoken>&projectName=<projectName>&clientId=<clientId>&projectCost=<projectCost>&jobIds=<jobIds>
请求参数:
authtoken | 指定身份验证令牌 |
projectName | 指定项目名称 |
clientId | 指定客户 ID |
projectCost | 指定项目成本 |
jobIds | 指定工作 ID(用逗号分隔) |
示例 URL:
http://people.zoho.com.cn/api/timetracker/addproject?authtoken=c0f4d58c9c922494c23b76ac919c2b48&user=2958000000067007&projectName=Google products&clientId=2958000000126297&projectCost=200000&jobIds=2958000000126497
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri="/api/timetracker/addproject">
<status>0</status>
<message>Project added successfully</message>
<result>
<projectId>2958000000137009</projectId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Project added successfully", "result": [ { "projectId": "2958000000137013" } ], "status": 0, "uri": "/api/timetracker/addproject" } }
针对添加项目的基于表单的 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_TimesheetJobsList/insertRecord?authtoken=a2aeec6f871980204791008133b2deb7&inputData={Project_Name:'Website Designing',ProjectCost:'45000',ClientId:'173907000000744041',Expected_End_date:'31-Jul-2015',jobIds:'173907000000276019;173907000000565035;173907000000630009',Description:'Directly handled by the CEO'}
XML 响应:
<?xml version=""1.0"" encoding=""UTF-8""?> <response uri=""/api/forms/xml/P_TimesheetJobsList/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_TimesheetJobsList/insertRecord"
}
}
注:
- 请参阅 https://people.zoho.com.cn/people/#admin/api/reference 或使用提取组件 API 来获取表单组件的列表。
- 对于编辑操作,使用 recordId 和 inputData。
- 要关联一个或多个工作至项目,请使用“jobIds”键。工作 ID 之间应使用分号隔开。
修改项目 API
此 API 用于修改项目。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/modifyproject?authtoken=<authtoken>&projectId=<projectId>&projectName=<projectName>&clientId=<clientId>&projectCost=<projectCost>&jobIds=<jobIds>
请求参数:
authtoken | 指定身份验证令牌 |
projectId | 指定项目 ID |
projectName | 指定项目名称 |
clientId | 指定客户 ID |
projectCost | 指定项目成本 |
jobIds | 指定工作 ID |
示例 URL:
http://people.zoho.com.cn/api/timetracker/modifyproject?authtoken=c0f4d58c9c922494c23b76ac919c2b48&user=2958000000067007&projectId=2958000000136077&projectName=Google products&clientId=2958000000126297&projectCost=200&jobIds=2958000000126497
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri="/api/timetracker/modifyproject">
<status>0</status>
<message>Project details modified successfully</message>
<result>
<projectId>2958000000136077</projectId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Project details modified successfully", "result": [ { "projectId": "2958000000136077" } ], "status": 0, "uri": "/api/timetracker/modifyproject" } }
更改项目状态 API
此 API 用于更改项目状态。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/changeprojectstatus?authtoken=<authtoken>&projectId=<projectId>&status=<status>
请求参数:
authtoken | 指定身份验证令牌 |
projectId | 指定项目 ID |
status | 指定状态为正在进行中或已完成 |
示例 URL:
http://people.zoho.com.cn/api/timetracker/changeprojectstatus?authtoken=c0f4d58c9c922494c23b76ac919c2b48&user=2958000000067007&projectId=2958000000136077&status=completed
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri="/api/timetracker/changeprojectstatus">
<status>0</status>
<message>Project status changed successfully</message>
<result>
<projectId>2958000000138001</projectId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Project status changed successfully", "result": [ { "projectId": "2958000000138001" } ], "status": 0, "uri": "/api/timetracker/changeprojectstatus" } }
删除项目 API
此 API 用于删除项目。
请求 URL:
http://people.zoho.com.cn/people/api/timetracker/deleteproject?authtoken=<authtoken>&projectId=<projectId>
请求参数:
authtoken | 指定身份验证令牌 |
projectId | 指定项目 ID(用逗号分隔) |
示例 URL:
http://people.zoho.com.cn/api/timetracker/deleteproject?authtoken=c0f4d58c9c922494c23b76ac919c2b48&projectId=2958000000136077
XML 响应:
<?xml version="1.0" encoding="UTF-8"?>
<response uri="/api/timetracker/deleteproject">
<status>0</status>
<message>Project deleted successfully</message>
<result>
<projectId>2958000000136077</projectId>
</result>
</response>
JSON 响应:
{ "response": { "message": "Project deleted successfully", "result": [ { "projectId": "2958000000136077" } ], "status": 0, "uri": "/api/timetracker/deleteproject" } }