Zoho CRM to Zoho Projects Workflow {"error":{"code":6831,"message":"Input Parameter Missing"}} connecting

Zoho CRM to Zoho Projects Workflow {"error":{"code":6831,"message":"Input Parameter Missing"}} connecting

  1. void automation.Untitled_Function(String ProjName)
  2. {
  3.     resp = invokeurl
  4.     [
  5.         url :"https://projectsapi.zoho.com/restapi/portals/"
  6.         type :GET
  7.         connection:"zohoprojects" 
  8.     ];
  9.     
  10.     info "Portal API Response: " + resp;

  11.     portalId = null;

  12.     if(resp != null)
  13.     {
  14.         if (resp.containsKey("portals"))
  15.         {
  16.             portalsData = resp.getJSON("portals");

  17.             if(portalsData != null)
  18.             {
  19.                 portalsDataStr = portalsData.toString();

  20.                 if(portalsDataStr.startsWith("[")) 
  21.                 {
  22.                     portallist = portalsData.toJSONList();
  23.                     if(portallist.size() > 0)
  24.                     {
  25.                         for each rec in portallist
  26.                         {
  27.                             if(rec.containsKey("id"))
  28.                             {
  29.                                 portalId = rec.getJSON("id");
  30.                                 break; 
  31.                             }
  32.                             else
  33.                             {
  34.                                 info "Error: 'id' key not found in portal record (from list): " + rec;
  35.                             }
  36.                         }
  37.                     }
  38.                     else
  39.                     {
  40.                         info "Error: Portal list is empty.";
  41.                     }
  42.                 }
  43.                 else if (portalsDataStr.startsWith("{")) 
  44.                 {
  45.                     portalObject = portalsData.toMap(); 
  46.                     if(portalObject.containsKey("id"))
  47.                     {
  48.                         portalId = portalObject.get("id");
  49.                     }
  50.                     else
  51.                     {
  52.                         info "Error: 'id' key not found in single portal object: " + portalObject;
  53.                     }
  54.                 }
  55.                 else
  56.                 {
  57.                     info "Error: 'portals' key contains unexpected data type. Value: " + portalsDataStr;
  58.                 }
  59.             }
  60.             else
  61.             {
  62.                 info "Error: 'portals' key is null.";
  63.             }
  64.         }
  65.         else if (resp.toString().startsWith("{") && resp.containsKey("id")) 
  66.         {
  67.             info "Response seems to be a single portal object itself (no 'portals' wrapper key).";
  68.             portalMap = resp.toMap(); 
  69.             portalId = portalMap.get("id");
  70.         }
  71.         else
  72.         {
  73.             info "Error: 'portals' key is missing in the response, and response is not a direct portal object. Response: " + resp;
  74.         }
  75.     }
  76.     else
  77.     {
  78.         info "Error: API response for portals is null.";
  79.         return;
  80.     }

  81.     if(portalId == null)
  82.     {
  83.         info "Error: Could not retrieve a Portal ID. Cannot proceed with project creation.";
  84.         return;
  85.     }
  86.     
  87.     info "Proceeding with Portal ID: " + portalId;

  88.     mp = Map();
  89.     mp.put("name", ProjName);
  90.     mp.put("template_id", "XXXXXXXXXXXXXXXXXXXX"); 
  91.     mp.put("start_date", today.toString("MM-dd-yyyy"));
  92.     mp.put("end_date", today.addDay(1).toString("MM-dd-yyyy"));
  93.     
  94.     createResp = invokeurl
  95.     [
  96.         url :"https://projectsapi.zoho.com/restapi/portal/" + portalId + "/projects/"
  97.         type :POST
  98.         parameters:mp.toString() 
  99.         connection:"zohoprojects" 
  100.     ];
  101.     
  102.     info "Create Project API Response: " + createResp;
  103. }

That is my code and it doesn't have any errors caught by Deluge. However, I am getting error code 6831 saying the Input Parameter Missing. I'm unsure what input parameter it is that is missing at this point. Could someone point me in the right direction?

Thank you!

    Nederlandse Hulpbronnen