Status Codes and Responses
In Zoho CRM, GraphQL API queries describe the status of the query through different HTTP status codes or error responses. The possible status codes or error responses are:
Success Response: Status 200 OK
Zoho CRM GraphQL APIs returns 200 OK status when a query runs successfully.
Error Responses
Zoho CRM GraphQL APIs return error in 200 and 400 HTTP status codes based on the type of error.
400 Status codes
Possible 400 status code errors
- FEATURE_NOT_ENABLEDHTTP 400
GraphQL feature not enabled for your profile.
Resolution: Invoke the Enable GraphQL API.
- FEATURE_NOT_SUPPORTEDHTTP 400
GraphQL APIs are queried from a Zoho CRM Edition that does not support GraphQL.
Resolution: Please try GraphQL APIs from one of the supported editions. It is supported for Enterprise, Zoho One Enterprise, CRM Plus and Ultimate edition orgs. Please note that GraphQL APIs are not available for Trial Edition of these editions.
- MANDATORY_NOT_FOUND HTTP 400
Request body is empty.
Resolution: Invoke using valid request body .
- OAUTH_SCOPE_MISMATCHHTTP 400
Invalid oauth scope to access a GraphQL.
Resolution: You do not have the right scope to access GraphQL. Create a new client with the valid scope for accessing GraphQL - ZohoCRM.GraphQL.Read.
200 Status codes
200 HTTP status codes are returned in two cases. (a) Error from GraphQL server due to issue in the input when validated against the schema and (b) runtime errors due to credits, depth and so on.
(a) Error from the GraphQL Server : GraphQL Error Representation
Error handling and response to client requests are outlined in the GraphQL Error Representation. In the case of a processing error in a query, GraphQL API provides a json response containing the "errors" field, which comprises an array containing one or more error objects. Each error object within the "errors" array encompasses the following fields:
- message: Description of the error.
- locations (optional): Indicates line and column of the location of the error in the query.
- extensions (optional): Indicates classification of the error.
Possible Errors
- DataFetchingException
Exemption during data fetching.
Resolution: Contact support team.
- ExecutionAborted
This error is thrown when query execution is aborted because the query complexity is greater than the allowed limit of 1000.
Resolution: Modify query to decrease complexity.
Example
- "Maximum query complexity exceeded 1100 > 1000."
- InvalidSyntax
Query syntax is invalid.
Resolution: Refer to the "message" and "location" key in the response for the details of syntax error and correct it.
Example
- "More than 200,000 'whitespace' tokens have been presented. To prevent Denial Of Service attacks, parsing has been cancelled."
- "More than 500 deep 'grammar' rules have been entered. To prevent Denial Of Service attacks, parsing has been cancelled."
- "More than 15,000 'grammar' tokens have been presented. To prevent Denial Of Service attacks, parsing has been cancelled."
- "More than 1,048,576 characters have been presented. To prevent Denial Of Service attacks, parsing has been cancelled."
- ValidationError
Query is invalid against the schema. This occurs when an invalid field or type name is used in the query.
Resolution: Refer to the "message" and "location" key in the response for the details of the wrong type or field error and correct it.
Example
- "Validation error (FieldUndefined@[Records/campaigns]) : Field 'campaigns' in type '_Records' is undefined."
- "Validation error (FieldUndefined@[Records/Campaigns/_data/Id]) : Field 'Id' in type 'Campaigns__data' is undefined."
(b) Runtime errors due to credits, depth and so on.
In the case of a runtime error in a query due to credits, depth and so on, the CRM Server returns error with 200 Status Code.
Possible Errors
- LIMIT_EXCEEDEDHTTP 200
Refer to the "message" key in the response for details and correct the query.
Example
- "Number of parent and child record fields exceed the maximum allowed limit."
- "Number of fields exceed the maximum allowed limit."
- "Criteria limit exceeded."
- "Number of multi-line fields exceed the maximum allowed limit."
- "Maximum query depth exceeded 4 > 3."
- "No.of sorting exceed the maximum allowed limit."
- INVALID_QUERY HTTP 200
Query is invalid.Refer to the "message" key in the response for details and correct the query.
Example
- "Null value is not compatible for the operator."
- "Field in the order by should have order key with valid value."
- "Value given seems to be invalid for the column."
- "Each field in the criteria must have exactly one mandatory operator."
- INVALID_DATAHTTP 200
Part of input in the query is invalid.Refer to the "message" key in the response for details and correct the query.
Example
- "Module is not supported in API."
- "The {resource} name given seems to be invalid"
- "The offset given is invalid."
- "The offset given is expired."
- INVALID_MODULEHTTP 200
The module name given seems to be invalid.
Resolution: Specify a valid module API name. Refer to possible modules section above. - INVALID_QUERYHTTP 200
Query is invalid. Refer to the "message" key in the response for details and correct the query.
Example
- "Each field in the criteria must have exactly one mandatory operator."
- "Field in the order by should have order key with valid value."
- "Null value is not compatible for the operator."
- "Value given seems to be invalid for the column."
- OAUTH_SCOPE_MISMATCHHTTP 200
User does not have a scope permission to access the module
Resolution: You do not have the right scope to access this API. Create a new client with the valid scope for accessing the module.