4

As Zoho is going to deprecate the v1 support for rest API. I am changing the API's to support v2.

Earlier there was a field in Lead module saying lastModifiedTime which helped to get only those leads which are modified. And the query string contained lastModifiedTime={SOMEDATETIME}.

But in the new version of API, I am not able to apply that criteria. Below is my URL.

https://www.zohoapis.com/crm/v2/Leads/search?criteria=(Modified Time:equals:2018-07-19T17:39:46+05:30)

I tried different fields but all the date fields are giving me the below error.

{ "code": "INVALID_QUERY", "details": { "reason": "the field is not available for search", "api_name": "Modified Time" }, "message": "invalid query formed", "status": "error" }

Furquan Khan
  • 1,586
  • 1
  • 15
  • 30

5 Answers5

5

It returns this error when you enter a non-existent API field name (or a hidden or inactive field). I was having the same problem, then I discovered that the API field name was spelled wrong (I was spelling it right, but it was spelled wrong in the database). Anyway, in your case it's probably just that you're missing the underscore; your API field name should probably be Modified_Time, as spaces are not allowed in API field names.

Clark
  • 51
  • 2
5

I think it is because you use space between words. Try to use _ between words in criteria

https://www.zohoapis.com/crm/v2/Leads/search?criteria=(Modified_Time:equals:2018-07-19T17:39:46+05:30)
Eugene
  • 61
  • 1
  • 4
3

Both answers are accurate. Check the Field Names under CRM -> Setup -> Developer Space -> API -> Field Names to make sure you use '_' and no spaces.

Also, if you are using compound search criteria, wrap everything in a (), so...

((Account_Name:equals:Acme Plumbing)and(Billing_City:starts_with:Denver))

failure to wrap everything in () will also spit out the same error

WebDrive
  • 1,248
  • 12
  • 19
0

I am using search Criteria in Postman using ZohoCreator Search API.
It's working fine on my postman passing the params variable.

Here is the postman image showing how to pass the value: Here is the postman image showing how to pass the value.

Joundill
  • 6,828
  • 12
  • 36
  • 50
shobhnath
  • 1
  • 4
0

The trick to finding the answer here is, unsurprisingly, reading the error message:

... "reason": "the field is not available for search",...

Quoting from the documentation:

To search for Date, DateTime, Lookup, Number, Currency, Boolean fields, you need comparators other than starts_with and equals. Refer to the Query API to search for fields of these data types.

You can only use the search records API for certain datatypes. You're searching for a datetime data type, which is not supported with the search records API. As the documentation says, you have to use the Query API for this (unfortunately. I'm in the same boat as you).

qozle
  • 140
  • 10