Namespace: CONNECTOR

CONNECTOR

Methods

staticZOHO.CRM.CONNECTOR.authorize(nameSpace){Promise}

Prompts the Connector Authorize window
Name Type Description
nameSpace String NameSpace of Connector to authorize
Returns:
Type Description
Promise resolved with true on successful Authorization
Example
var connectorName = "zoho.authorize";
ZOHO.CRM.CONNECTOR.authorize(connectorName);

staticZOHO.CRM.CONNECTOR.invokeAPI(nameSpace, data){Promise}

Invokes Connector API
Name Type Description
nameSpace String NameSpace of Connector API to invoke
data Object Connector API Data
Name Type Description
VARIABLES Object Dynamic Data represented by placeholders in connectorAPI
CONTENT_TYPE Object ContentType - multipart for multipart request
PARTS Array For multipart request provide parts config here
FILE Object To include a file in your multipart request
Returns:
Type Description
Promise resolved with response of the Connector API
Examples
var data = {
     "apikey" : "*********", 
     "First_Name" : "Naresh",  
     "Last_Name" : "Babu", 
     "email" : "naresh.babu@zylker.com"
}
ZOHO.CRM.CONNECTOR.invokeAPI("MailChimp.sendSubscription",data)
.then(function(data){
    console.log(data)
})
var data = {
    "CONTENT_TYPE":"multipart",
    "PARTS":[
              {
                  "headers": {  
                      "Content-Type": "application/json"
                  },
                  "content": {"mimeType": "application/vnd.google-apps.folder", "title": "NareshFolder"
                  }
              }
            ]
  }
  ZOHO.CRM.CONNECTOR.invokeAPI("ex10.testconnector.uplaodfile",data)
  .then(function(data){
      console.log(data)
  })
var file = document.getElementById("File").files[0];
var fileType;
  if (file.type === "application/pdf"){
    fileType = file.type;
  }
  else if(file.type === "image/jpeg"){
    fileType = file.type;
  }
  else if(file.type === "text/plain"){
    fileType = "application/msword";
  }
  else if(file.type === ""){
    fileType = "application/msword";
  }
  console.log(file);
  var data = {
    "VARIABLES":{
      "pathFileName" : "/Zoho CRM/myFile/"+file.name
    },
    "CONTENT_TYPE":"multipart",
    "PARTS":[
              {
                "headers": {  
                  "Content-Type": "application/json"
                },
                "content": {"mimeType": fileType,"description": "TestFile to upload", "title":file.name}
              },{
                "headers": {
                  "Content-Disposition": "file;"
                },
                "content": "__FILE__"
              }
            ],
    "FILE":{
      "fileParam":"content",
      "file":file
    },
  }
  console.log(data);
  ZOHO.CRM.CONNECTOR.invokeAPI("ex10.testconnector.uplaodfile",data)
  .then(function(data){
      console.log(data)
  })