Get Records From Zoho Projects

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>

(optional)

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: 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.
Click here for an example to fetch the first three comments associated with a task.

<range>

(optional)

NUMBER

The number of records that need to be fetched.

Note: You should specify the index value to be able to set range.

<connection>

(optional)

TEXT

The link name of the connection.

Note: This parameter is applicable to all Zoho services that have connections support, except Zoho Creator.

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");

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.

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);

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);

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);

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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com