Get Records From Zoho Projects
Table of Contents
Description
The zoho.projects.getRecords task fetched all the records from the specified module in Zoho Projects.
- For security reasons, if you execute Zoho Projects integration tasks for more than 100 times under 2 minutes, you will be restricted to execute any Zoho Projects integration task for the next 30 mins.
Syntax
<response> = zoho.projects.getRecords(<portal>, <project_id>, <module>, <dataMap/index>, <range>, <connection>);
where:
Params | Data type | Description |
<response> | KEY-VALUE | The details of the records fetched from the specified Zoho Projects module. |
<portal> | TEXT/ NUMBER | The name or ID of the portal. Note: You can get the name or ID of the portal using the get portals task. Click here to learn more about it. |
<project_id> | NUMBER | The ID of the project. Note: You can get project_id using the get project details task. Click here to learn more about it. |
<module> | TEXT | The name of the module from which the records need to be fetched. Allowed values:
|
<dataMap/index> | NUMBER/ KEY-VALUE | The start index number from which the records need to be fetched. The index number of the records starts with 0. (or) The parameters, as specified in the Zoho Projects API. The API documents for all the allowed modules are listed below: Note: i) In Zoho Projects, comments is a submodule to the tasks and bugs module.
ii) To skip this param, include a 0 in its place in the syntax. Click here for an example to fetch the first three comments associated with a task. |
<range> | NUMBER | The number of records that need to be fetched. Note:
|
<connection> | TEXT | The link name of the connection. A connection to Zoho Projects needs to be established in order to get records. Note:
|
Example 1
The following script fetches all the records from the module - tasks of the specified project and portal in Zoho Projects:
response = zoho.projects.getRecords("zylker", 548XXXXXXXXXXX771, "tasks", 0, 0, "projects");
where:
response
"zylker"
548XXXXXXXXXXX771
"tasks"
"projects"
Example 2
The following script fetches all the tasks whose priority is high from the specified project and portal of Zoho Projects:
data_map = Map(); data_map.put("priority", "high"); response = zoho.projects.getRecords("zylker", 548XXXXXXXXXXX771, "tasks", data_map, 0, "projects");
where:
data_map
Example 3
The following script fetches 3 tasks starting from the task index - 5 from the specified project and portal of Zoho Projects:
response = zoho.projects.getRecords("zylker", 548XXXXXXXXXXX771, "tasks", 5, 3, "projects");
where:
5
3
Example 4: Fetch the first three comments associated with a task
The following script fetches the first three comments associated with the specified task from Zoho Projects:
data_map = Map(); data_map.put("taskid", "548XXXXXXXXXXX888"); data_map.put("index", "1"); data_map.put("range", "3"); response = zoho.projects.getRecords("zylker", 548XXXXXXXXXXX771, "comments", data_map, 0, "projects");
where:
"taskid"
"548XXXXXXXXXXX888"
Response Format
Success Response
The success response will be returned in the following format:
{
"tasks": [
{
"milestone_id": "548XXXXXXXXXXX873",
"link": {
"timesheet": {
"url": "https://projects.zoho.com/restapi/portal/58XXXX95/projects/548XXXXXXXXXXX7771/tasks/548XXXXXXXXXXX899/logs/"
},
"self": {
"url": "https://projects.zoho.com/restapi/portal/58XXXX95/projects/548XXXXXXXXXXX771/tasks/548XXXXXXXXXXX899/"
}
},
"is_comment_added": false,
"completed_time_format": "08-12-2019 04:57:45 PM",
"duration": "0",
"last_updated_time_long": 1565609265550,
"is_forum_associated": false,
"details": {
"owners": [
{
"name": "Unassigned"
}
]
},
"id": 548XXXXXXXXXXX899,
"key": "OR1-T3",
"created_person": "Shawn",
"created_time_long": 1565609245287,
"created_time": "08-12-2019",
"is_reminder_set": false,
"is_recurrence_set": false,
"created_time_format": "08-12-2019 04:57:25 PM",
"subtasks": false,
"work": "0:00",
"isparent": false,
"duration_type": "days",
"completed_time_long": 1565609265550,
"work_type": "work_hrs_per_day",
"task_followers": {
"FOLUSERS": "",
"FOLLOWERSIZE": -1,
"FOLLOWERS": [
]
},
"completed": true,
"priority": "None",
"created_by": "58XXXX70",
"percent_complete": "100",
"last_updated_time": "08-12-2019",
"completed_time": "08-12-2019",
"name": "task 2",
"id_string": "548XXXXXXXXXXX899",
"last_updated_time_format": "08-12-2019 04:57:45 PM",
"tasklist": {
"name": "New task list",
"id": "548XXXXXXXXXXX881"
},
"order_sequence": 1,
"status": {
"name": "Closed",
"id": "548XXXXXXXXXXX003",
"type": "closed",
"color_code": ""
}
}
]
}
Failure Response
The failure response for invalid project ID will be returned in the following format:
{
"error": {
"code": 6404,
"message": "Resource Not Found"
}
}The failure response for invalid portal name will be returned in the following format:
{
"error": {
"code": 6504,
"message": "Domain Not Available"
}
}The failure response for invalid portal ID will be returned in the following format:
{
"error": {
"code": 6500,
"message": "General Error"
}
}