Choose where you’d like to start

Get Records From Zoho Projects

Description

The zoho.projects.getRecords task fetched all the records from the specified module in Zoho Projects.

Note:
  • 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:

ParamsData typeDescription

<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:

  • milestones
  • taskLists
  • tasks
  • bugs
  • logs
  • comments

<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.
  • To fetch comments associated with a task, it is mandatory to specify the key - taskid and the ID of the task as its value.
  • To fetch comments associated with a bug, it is mandatory to specify the key - bugid and the ID of the bug as its value.

         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:

  • You should specify the index value to be able to set range.
  • To skip this param, include a 0 in its place in the syntax.

<connection>

TEXT

The link name of the connection. A connection to Zoho Projects needs to be established in order to get records.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes as mentioned in Zoho Projects API -> <Zoho Projects>-> <Module> -> Scope.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

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
The KEY-VALUE response returned by Zoho Projects. It represents the details of the records fetched.
"zylker"
The TEXT that represents the name of the portal.
548XXXXXXXXXXX771
The NUMBER that represents the project ID.
"tasks"
The TEXT that represents the name of the module from which the records need to be fetched.
"projects"
The TEXT that represents the connection established between Creator and Projects. The scope for this connection is ZohoProjects.tasks.{ALL}.

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
The KEY-VALUE variable that holds the parameters as specified in the Zoho Projects API. Here, the parameter - priority is set to high to fetch only the tasks with high priority.

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
The NUMBER that represents the start index from which the records need to be fetched.
3
The NUMBER that represents how many records need to be fetched.

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"
The TEXT that represents the key that holds the ID of the task
"548XXXXXXXXXXX888"
The TEXT that represents ID of the task with which the required comments are asssociated.

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"
      }
      }

Related Links

Get Started Now

Execute