JS SDK

Prerequisite

Include the JS http://js.zohostatic.com/projects/marketplace_apps/1.0/js/client_sdk.min.js in your code before calling the following SDK methods.

init

Initializes the extension.


zohobugtracker.init().then(function(){});

 

Invoking this method at the beginning is necessary since the other SDK methods will work only after its invocation. While init is loading if you want to use other functions you can use it within the init function


zohobugtracker.init().then(function () {
 zohobugtracker.get("portal.name").then(function (response) {console.log(response);});
});

metadata

Fetches the payment and configuration details of an extension.

zohobugtracker.metadata().then(function(response)
{
console.log(response);
/* output
{
  "data": {
    "configs": [
      {
        "name": "Name",
        "type": "text",
        "is_mandatory": true,
        "is_secure": false,
        "description": "Enter your name",
        "value": "Helen Collins"
      },
      {
        "name": "Employee ID",
        "type": "text",
        "is_mandatory": true,
        "is_secure": false,
        "description": "Enter your Emp. ID",
        "value": "EMP08"
      }
    ],
    "payments_info": {
      "edition": "trial"
    },
    "status": "success"
  }
}
*/
});

context

Fetches the module name and entity ID of the current location. The module name is 'issues' and the entity ID is the ID of the respective issue.


zohobugtracker.context().then(function(response)
{
console.log(response);
/* output
{
  "module_name": "bugs",
  "entity_id": "27092000000031079"
}
*/
});

 

We do not give the entity ID for the widget location 'app_settings'.

get

Fetches the details of the instances, current user, portal, project, and issues of the current location.


zohobugtracker.get("issue.id_string").then(function(response)
{
/* output
{
  "data": 27092000000031080,
  "status": "success"
}
*/
});

The following are the list of keys that can be used in the get method:

Instances

  • instances

Current user

  • current_user

Portal

  • portal.trial_enabled
  • portal.settings
  • portal.gmt_time_zone
  • portal.project_count
  • portal.role
  • portal.avail_user_count
  • portal.locale
  • portal.project_prefix
  • portal.available_projects
  • portal.max_user_count
  • portal.profile_id
  • portal.name
  • portal.id_string
  • portal.bug_plural
  • portal.plan
  • portal.bug_plan
  • portal.bug_singular
 portal.default
  • portal.extensions
  • portal.is_crm_partner
  • portal.is_display_projectprefix
  • portal.is_new_plan
  • portal.layouts
  • portal.link

Project

  • project.is_strict
  • project.role
  • project.bug_count
  • project.owner_id
  • project.bug_prefix
  • project.link
  • project.description
  • project.milestone_count
  • project.updated_date_long
  • project.bug_count
  • project.updated_date_format
  • project.workspace_id
  • project.billing_status
  • project.key
  • project.is_chat_enabled
  • project.owner_name
  • project.profile_id
  • project.enabled_tabs
  • project.name
  • project.is_public
  • project.layout_details
  • project.status
  • project.permissions
  • project.IS_BUG_ENABLED
  • project.bug_defaultview

  • project.bug_prefix
  • project.cascade_setting
  • project.completed_on
  • project.completed_on_long
  • project.created_date
  • project.created_date_format
  • project.created_date_long

  • project.custom_status_id
  • 
project.id_string
  • project.show_project_overview

  • project.start_date

  • project.start_date_long
  • project.updated_date

  • project.users

Issue

  • issue.module
  • issue.created_time_long
  • issue.customfields
  • issue.status
  • issue.reproducible
  • issue.link
  • issue.severity
  • issue.reported_person
  • issue.title
  • issue.flag
  • issue.assignee_name
  • issue.reporter_id
  • issue.classification
  • issue.created_time_format
  • issue.closed
  • issue.created_time
  • issue.key
  • issue.attachment_count
  • 
issue.bug_number
  • 
issue.bug_prefix

  • issue.comment_count
  • 
issue.escalation_level
  • 
issue.id_string

  • issue.reporter_email
  • issue.reporter_non_zuser
  • 
issue.updated_time
  • 
issue.updated_time_format
  • 
issue.updated_time_long
  • issue.attachments
  • issue.comments
  • issue.views

Chosen files

A file that is in queue to be uploaded is stored in chosen_files.This key is supported only for attachment picker.

  • chosen_files

Profile

We support a couple of keys that fetch all the profiles at the portal level and the profile details of the current user respectively.

  • all_profiles: Fetches the information of all the profiles in a portal.
  • current_profile: Fetches the profile details of the current user.

set

Updates the attributes of a specific issue or project of the current location.


var nameObj={name:"Create a new checklist"};
zohobugtracker.set("issue",nameObj).then(function(response)
{
/* output
{
  "data": {
    "bugs": [
      {
        "milestone_id": "2*******************2",
        "link": {
          "timesheet": {
            "url": "https://p*************e.********.com/restapi/portal/5******7/projects/2****************9/bugs/2****************9/logs/"
          },
          "self": {
            "url": "https://p*************e.********.com/restapi/portal/5******7/projects/2****************9/bugs/2****************9/"
          }
        },
        "description": "",
        "duration": "0",
        "last_updated_time_long": 1542193097398,
        "details": {
          "owners": [
            {
              "name": "JOHN MARSH",
              "id": "5************3"
            }
          ]
        },
        "id": 2************0,
        "key": "WEUT-T1",
        "created_person": "Steve Banks",
        "created_time_long": 1525668983347,
        "created_time": "05-07-2018",
        "is_reminder_set": false,
        "is_recurrence_set": false,
        "created_time_format": "05-07-2018 10:26:23 AM",
        "work": "0:00",
        "custom_fields": [
          {
            "column_name": "UDF_LONG1",
            "label_name": "Expense Amount",
            "value": "24573"
          },
          {
            "column_name": "UDF_LONG3",
            "label_name": "sample",
            "value": "0"
          },
          {
            "column_name": "UDF_LONG2",
            "label_name": "test",
            "value": "200"
          }
        ],
        "isparent": false,
        "work_type": "work_hrs_per_day",
        "completed": false,
        "priority": "None",
        "created_by": "5******3",
        "percent_complete": "0",
        "last_updated_time": "11-14-2018",
        "name": "Create a new checklist",
        "id_string": "2************9",
        "last_updated_time_format": "11-14-2018 04:28:17 PM",
        },
        "order_sequence": 1,
        "status": {
          "name": "Open",
          "id": "2************1",
          "type": "open",
          "color_code": ""
        }
      }
    ]
  },
  "status": "success"
}
*/
});

The following keys can be used in the set method to update an issue:

Issues

  • title
  • description
  • assignee
  • flag
  • classification_id
  • milestone_id
  • due_date
  • module_id
  • severity_id
  • reproducible_id
  • status_id
  • resolution
  • affectedmile_id

The following keys can be used in the set method to update project:

Projects

  • name
  • description
  • status
  • start_date
  • end_date
  • strict_project
  • public
  • group_id
  • completed_on
  • UDF_CHAR([1-9]|[1-2][0-9]|30). Example: UDF_CHAR1
  • UDF_TEXT([1-9]|1[0-5])
  • UDF_LONG([1-9]|1[0-5])
  • UDF_USER[1-5]
  • UDF_DOUBLE([1-9]|[1-2][0-9]|3[0-5])
  • UDF_DATE[1-5]
  • UDF_ENCRYPT([1-9]|10)
  • owner
  • billing_method
  • bill_status
  • show_project_overview
  • custom_status

Link files

Use linkfiles key to associate files to your location. This key supports the following locations: Issue details tab, Attachment picker. It must be an array of maximum size 10 and the following fields are mandatory: id, name, type, permanent_url, download_url, size, created_by, created_time; preview_url is mandatory for image files.

  • linkfiles

linkfiles=[{
        "created_time": 1561028014712,
        "id": "1LavBS5sauJ-AAFJZWp8Ch9Cp2ehydahk",
"type": "image/jpeg",
        "created_by": "Patricia Boyle",
        "permanent_url": "https://***************",
        "size": 7409,
        "preview_url": "https://******************",
        "name": "sample-image.jpeg",
        "download_url": "https://drive.google.com/a/web-mailhosting.com/uc?id=1LavBS5sauJ-AAFJZWp8Ch9Cp2ehydahk&export=download",
      }]
zohobugtracker.set('linkfiles', linkFiles).then(function (response) {
      zohobugtracker.invoke('attachment_picker.close');
});

request

Invokes a third-party URL from your extension using the connection defined in the plugin-manifest.json file. If the connection link name is not specified then the response is provided based on the inputs.


var file = document.getElementById("inputbox").files[0];
var file_detail = {
type: "GET",
files: {
   uploaddoc : file
       },
parameters: {
fields: "id,name, thumbnailLink, webViewLink, webContentLink"
}
};
var url = "https://www.googleapis.com/drive/v3/files/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu";
zohobugtracker.request(url, file_detail, "google_drive").then(function (response)
/* Output
{ 
"result": {
    "webContentLink": "https://drive.google.com/uc?id=1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu&export=download",
    "name": "Eiffel_Tower_01.jpg",
    "webViewLink": "https://drive.google.com/file/d/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu/view?usp=drivesdk",
    "id": "1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu",
    "thumbnailLink": "https://lh3.googleusercontent.com/nhyq9mHrGDOZfNdQUHRj_xVlOoNAP5PEYkW4X2svGXKjVt53MvMGfjhQ2PlTv4cmv5-PgbjrR-c=s220"
  },
  "status": "success"
}
*/
});

Argument nameData typeDescription
URLstringThe third-party URL that has to be invoked from your extension.
objectJSONObjectKeyData typeValue
  typestring"GET" / "POST"
  parametersJSONObjectThe request params of the API.
  headersJSONObjectThe headers of the API.
  bodyJSONObjectThe body of the API.
  replace_secure_configBoolean

If the is_secure parameter in the plugin-manifest.json file is true, set the value of this param to true.

Zoho BugTracker will replace the value in the URL.

Note: The default value is false.

connection_link_namestringThe connection link name generated from the zapps website.