Zoho Projects API v3 - How to format filter critera in deluge

Zoho Projects API v3 - How to format filter critera in deluge

I'm trying to return the id of a client company in the Zoho Projects API using Zoho Flow and am running into issues about how I format critera in deluge.

https://projects.zoho.com/api-docs#clients#get-clients

I have several hundred Client Companies, and the example response for one of them looks like this :

  1. "clients": [
  2.       {
  3.             "zipcode": "",
  4.             "address_second": "",
  5.             "country": "",
  6.             "city": "",
  7.             "zohocrm_account_id": "272658000004270001",
  8.             "address_first": "",
  9.             "name": "Acme",
  10.             "id": "91102000007078211",
  11.             "state": "",
  12.             "webaddress": ""
  13.         },


I am using this Deluge

  1. string ZP_FetchClientCompany()
    {
        // Replace client company id with variables. This is just for testing
        varClientName = "Acme";
        varCRMID = 272658000025608001;

        // Create a filter parameter (ensure correct JSON format)
        filterParam = {
            "criteria": [
                {
                    "field_name": "name",
                    "criteria_condition": "contains",
                    "value": varClientName
                }
            ],
            "pattern": "1"
        };

        // Convert to proper JSON format
        filterJSON = filterParam.toJSONList();

        // Create parameter map with the correct JSON format
        paramMap = Map();
        paramMap.put("filter", filterJSON);

        // Send the request
        updateResponse = invokeurl
        [
            url :"https://projectsapi.zoho.eu/api/v3/portal/MYPORTAL/clients"
            type :GET
            parameters:paramMap
            connection:"MY_CONNECTION"
        ];

        info updateResponse;
        return updateResponse;
    }

When I run this code I get the error :

{
   error : {
      status_code : "400",
      instance : "/api/v3/portal/20070208318/clients",
      title : "JSON_PARSE_ERROR",
      error_type : "FIELDS_VALIDATION_ERROR",
      details : [
         {
            message : "Invalid JSON syntax",
            field_name : "filter"
         }
      ]
   }
}

I have tried so many ways of formatting the filter and I can't get it to work : I just want to find the record that matches the Company Name