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-clientsI have several hundred Client Companies, and the example response for one of them looks like this :
-
"zohocrm_account_id": "272658000004270001",
"id": "91102000007078211",
I am using this Deluge
- 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