This document explains about the various error responses the inQuiry micro service currently throws. The intent of this document is to look through the errors and classify it and propose any changes in terms of error reporting.

Broadly classified, there are three types of error responses that are coming out of the APIs.

Error Classification

HTTP Status Code

Description / Usage

CLIENT_ERROR

400

The client sends a bad request that resulted in service validating and throwing the error.

RESOURCE_NOT_FOUND

404

The client request for a resource that is not found in the server.

SERVER_ERROR

500

Service resulted in unexpected results while processing the client request.

Reference : org.sunbird.common.exception.ResponseCode

Sunbird Exception Hierarchy



Current Scenarios of various exceptions

The below exceptions are from release 5.6.0

1Class 2 ClientException 3 assessment-actors (31 usages found) 4 org.sunbird.managers (26 usages found) 5 AssessmentManager.scala (22 usages found) 6 34 throw new ClientException(errCode, "Visibility cannot be Parent!") 7 53 throw new ClientException("ERR_ACCESS_DENIED", s"$resName visibility is private, hence access denied") 8 61 if (StringUtils.isBlank(request.getRequest.getOrDefault("channel", "").asInstanceOf[String])) throw new ClientException("ERR_INVALID_CHANNEL", "Please Provide Channel!") 9 69 throw new ClientException("ERR_ACCESS_DENIED", "Channel id is not matched") 10 83 throw new ClientException(errCode, node.getMetadata.getOrDefault("objectType", "").asInstanceOf[String].replace("Image", "") + " with visibility Parent, can't be updated individually.") 11 92 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with visibility Parent, can't be sent for review individually.") 12 94 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with status other than Draft can't be sent for review.") 13 107 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with visibility Parent, can't be sent for review individually.") 14 109 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with status other than Draft can't be sent for review.") 15 112 throw new ClientException("ERR_MANDATORY_FIELD_VALIDATION", s"Mandatory Fields ${messages.asJava} Missing for ${node.getIdentifier.replace(".img", "")}") 16 139 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with visibility Parent, can't be sent for publish individually.") 17 141 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} having Processing status can't be sent for publish.") 18 152 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with visibility Parent, can't be sent for publish individually.") 19 154 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} having Processing status can't be sent for publish.") 20 157 throw new ClientException("ERR_MANDATORY_FIELD_VALIDATION", s"Mandatory Fields ${messages.asJava} Missing for ${node.getIdentifier.replace(".img", "")}") 21 165 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with identifier : ${node.getIdentifier} is already Retired.") 22 174 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} with visibility Parent, can't be sent for reject individually.") 23 176 throw new ClientException(errCode, s"${node.getObjectType.replace("Image", "")} is not in 'Review' state for identifier: " + node.getIdentifier) 24 185 throw new ClientException("ERR_QUESTION_SET_ADD", "Node with Identifier " + node.getIdentifier + " is not a Question Set") 25 216 throw new ClientException("ERR_QUESTION_SET", "Object with identifier: " + content.get("identifier") + " is not Live. Please Publish it.") 26 237 throw new ClientException("ERR_MANDATORY_FIELD_VALIDATION", s"Mandatory Fields ${messages.asJava} Missing for ${content.get("identifier").toString}") 27 284 if (StringUtils.isBlank(beJobRequestEvent)) throw new ClientException("BE_JOB_REQUEST_EXCEPTION", "Event is not generated properly.") 28 CopyManager.scala (4 usages found) 29 61 requestObjectType, nodeObjectType)) throw new ClientException(AssessmentConstants.ERR_INVALID_OBJECT_TYPE, s"Please Provide Valid ${requestObjectType} Identifier 30 63 throw new ClientException(AssessmentConstants.ERR_INVALID_REQUEST, "Question With Visibility Parent Cannot Be Copied Individually!") 31 270 throw new ClientException(AssessmentConstants.ERR_INVALID_REQUEST, "Please provide valid value for " + keysNotPresent) 32 276 throw new ClientException(AssessmentConstants.ERR_INVALID_REQUEST, "QuestionSet With Status " + node.getMetadata.get(AssessmentConstants 33 org.sunbird.utils (5 usages found) 34 RequestUtil.scala (5 usages found) 35 24 getRequest.containsKey(prop))) throw new ClientException("ERROR_RESTRICTED_PROP", "Properties in list " + restrictedProps.mkString("[", ", ", "]") + " are not 36 29 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Request Body cannot be Empty.") 37 32 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Cannot update content status to : ${SYSTEM_UPDATE_ALLOWED_CONTENT_STATUS.mkString("[", ", ", "]")}.") 38 38 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "Required field identifier is missing or empty.") 39 41 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "Request contains more than the permissible limit of identifiers: " + reqSize + ". Permissible limit is: "+questionListLimit) 40 qs-hierarchy-manager (24 usages found) 41 org.sunbird.managers (24 usages found) 42 HierarchyManager.scala (11 usages found) 43 124 throw new ClientException("ERR_BRANCHING_LOGIC", s"Branching Is Not Enabled For ${rootNode.getIdentifier}. Please Enable Branching Or Remove branchingLogic from Request.") 44 255 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "rootId is mandatory") 45 258 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "children are mandatory") 46 262 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "Branch Rule Found For The Node Which Is Not A Children Having Identifier 47 281 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "Children which are not available are: " + filteredList) 48 285 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Children must be of types $ASSESSMENT_OBJECT_TYPES for ids: ${invalidNodes.map(_.getIdentifier)}") 49 320 throw new ClientException("ERR_BRANCHING_LOGIC", s"Branching Is Not Enabled For ${unitId}. Please Enable Branching Or Remove branchingLogic from Request.") 50 696 throw new ClientException("ERR_BRANCHING_LOGIC", s"Dependent Children Found! Please Remove Children With Identifiers ${target} For Node : ${identifier}") 51 708 throw new ClientException("ERR_BRANCHING_LOGIC", s"Source With Identifiers ${sourceIds.diff(childrenIds).asJava} Not Found! Please Provide Valid Source Identifier.") 52 716 throw new ClientException("ERR_BRANCHING_LOGIC", "An Object Can't Depend On More Than 1 Object") 53 721 throw new ClientException("ERR_BRANCHING_LOGIC", s"${source.get(0)} Is Already Children Of ${pSource.get(0)}. So It Can't Be Parent For ${entry._1}") 54 UpdateHierarchyManager.scala (13 usages found) 55 66 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "Hierarchy data is empty") 56 72 throw new ClientException("ERR_QS_UPDATE_HIERARCHY", "Question cannot have children in hierarchy") 57 90 throw new ClientException(HierarchyErrorCodes.ERR_INVALID_ROOT_ID, "Please Provide Valid Root Node Identifier") 58 102 throw new ClientException(HierarchyErrorCodes.ERR_INVALID_ROOT_ID, "Invalid MimeType for Root Node Identifier : " + identifier) 59 106 throw new ClientException(HierarchyErrorCodes.ERR_INVALID_ROOT_ID, "Invalid Visibility found for Root Node Identifier : " + identifier) 60 195 throw new ClientException("ERR_UPDATE_QS_HIERARCHY", s"Object Type is mandatory for creation of node with id: ${nodeModified._1}") 61 198 throw new ClientException("ERR_UPDATE_QS_HIERARCHY", s"Visibility can be only of type Parent for identifier: ${nodeModified._1}") 62 200 throw new ClientException("ERR_UPDATE_QS_HIERARCHY", s"Visibility can be only of type ${HierarchyConstants.QUESTION_VISIBILITY.asJava} for identifier: ${nodeModified._1}") 63 524 throw new ClientException("ERR_BRANCHING_LOGIC", s"Branching Is Not Enabled For: ${node.getIdentifier}. Please Remove branchingLogic from ${node.getIdentifier}") 64 541 throw new ClientException("ERR_BRANCHING_LOGIC", s"Please Provide Branching Rules for : ${branchingLogic.keySet.toList.diff(target).asJava}") 65 544 throw new ClientException("ERR_BRANCHING_LOGIC", s"Please Provide Dependent Object Within Same Parent having identifier : ${node.getIdentifier}") 66 547 throw new ClientException("ERR_BRANCHING_LOGIC", "An Object Can't Depend On More Than 1 Object") 67 550 throw new ClientException("ERR_BRANCHING_LOGIC", "A Dependent Object Can't Have Further Dependent Object") 68 Maven: org.sunbird:graph-engine_2.11:1.0-SNAPSHOT (18 usages found) 69 src.main.scala.org.sunbird.graph.nodes (6 usages found) 70 DataNode.scala (6 usages found) 71 77 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), "identifiers is mandatory") 72 179 else throw new ClientException("ERR_INVALID_RELATION_OBJECT", "Invalid Relation Object Found.") 73 216 if (metadata.isEmpty) throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Invalid Request. Cannot update status of Image Node to $status.") 74 261 throw new ClientException(ResponseCode.RESOURCE_NOT_FOUND.name(), s"Error! Node(s) doesn't Exists with identifier : ${request.getContext.get("identifier")}.") 75 266 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Cannot update content with FAILED status for id : ${node.getIdentifier}.") 76 304 throw new ClientException(ErrorCodes.ERR_BAD_REQUEST.name(), s"Request contains invalid identifiers : ${missingIds.mkString("[", ", ", "]")}.") 77 src.main.scala.org.sunbird.graph.relations (2 usages found) 78 RelationHandler.scala (2 usages found) 79 18 throw new ClientException(GraphErrorCodes.ERR_RELATION_CREATE.toString, "UnSupported Relation: " + relationType) 80 21 throw new ClientException(GraphErrorCodes.ERR_RELATION_CREATE.toString, "UnSupported Relation: " + relationType) 81 src.main.scala.org.sunbird.graph.schema (1 usage found) 82 DefinitionDTO.scala (1 usage found) 83 126 throw new ClientException(ResponseCode.CLIENT_ERROR.name, "Invalid request", java.util.Arrays.asList("Invalid Props are : " + invalidProps.asJavaCollection)) 84 src.main.scala.org.sunbird.graph.schema.validator (9 usages found) 85 FrameworkValidator.scala (2 usages found) 86 52 case _ => throw new ClientException("CLIENT_ERROR", "Validation Errors.", util.Arrays.asList("Please provide correct value for [" + cat + "]")) 87 64 throw new ClientException("CLIENT_ERROR", "Validation Errors.", errors) 88 PropAsEdgeValidator.scala (4 usages found) 89 30 throw new ClientException("ERR_INVALID_EDGE_PROPERTY", key + " value should be one of " + list) 90 34 throw new ClientException("ERR_INVALID_EDGE_PROPERTY", key + " value should be any of " + list) 91 36 throw new ClientException("ERR_INVALID_EDGE_PROPERTY", key + " given datatype is invalid.") 92 39 throw new ClientException("ERR_EMPTY_EDGE_PROPERTY_LIST", "The list to validate input is empty.") 93 RelationValidator.scala (1 usage found) 94 45 throw new ClientException(ResponseCode.CLIENT_ERROR.name, "Error while validating relations :: " + errList) 95 VersionKeyValidator.scala (2 usages found) 96 26 if(!isValid)throw new ClientException(ResponseCode.CLIENT_ERROR.name, "Invalid version Key") 97 55 throw new ClientException("BLANK_VERSION", "Error! Version Key cannot be Blank. | [Node Id: " + node.getIdentifier + "]") 98 Maven: org.sunbird:platform-common:1.0-SNAPSHOT (10 usages found) 99 org.sunbird.common (2 usages found) 100 HttpUtil (2 usages found) 101 getMetadata(String, Map<String, String>) (2 usages found) 102 79 throw new ClientException("ERR_API_CALL", "Fetching of file related metadata Failed with response code " + response.getStatus() + " and message: " + response.getStatusText()); 103 82 throw new ClientException("ERR_API_CALL", "Something Went Wrong While Making API Call | Error is: " + e.getMessage()); 104 Maven: org.sunbird:schema-validator:1.0-SNAPSHOT (1 usage found) 105 org.sunbird.schema.dto (1 usage found) 106 ValidationResult (1 usage found) 107 ValidationResult(List<String>, Map<String, Object>, Map<String, Object>, Map<String, Object>) (1 usage found) 108 28 throw new ClientException(ResponseCode.CLIENT_ERROR.name(), "Validation Errors", messages);


1Class 2 ResourceNotFoundException 3 New instance creation (14 usages found) 4 qs-hierarchy-manager (2 usages found) 5 org.sunbird.managers (2 usages found) 6 UpdateHierarchyManager.scala (2 usages found) 7 267 throw new ResourceNotFoundException("ERR_UPDATE_QS_HIERARCHY", s"No node found with id: $nodeId") 8 288 } else throw new ResourceNotFoundException(HierarchyErrorCodes.ERR_CONTENT_NOT_FOUND, "Content not found with identifier: " + nodeId) 9 Maven: org.sunbird:graph-engine_2.11:1.0-SNAPSHOT (6 usages found) 10 src.main.scala.org.sunbird.graph.schema (2 usages found) 11 CategoryDefinitionValidator.scala (2 usages found) 12 56 throw new ResourceNotFoundException(resp.getParams.getErr, resp.getParams.getErrmsg + " " + resp.getResult) 13 62 throw new ResourceNotFoundException(channelCatResp.getParams.getErr, channelCatResp.getParams.getErrmsg + " " + channelCatResp.getResult) 14 src.main.scala.org.sunbird.graph.schema.validator (4 usages found) 15 FrameworkValidator.scala (3 usages found) 16 182 throw new ResourceNotFoundException("ERR_VALIDATING_CONTENT_FRAMEWORK", s"Nodes not found for Id's $ids ") 17 195 throw new ResourceNotFoundException("ERR_VALIDATING_CONTENT_FRAMEWORK", s"No nodes found for $termName with ids: ${node.getMetadata.get(termName)}") 18 197 throw new ResourceNotFoundException("ERR_VALIDATING_CONTENT_FRAMEWORK", s"No nodes found for $termName with ids: ${node.getMetadata.get(termName)}") 19 VersioningNode.scala (1 usage found) 20 44 throw new ResourceNotFoundException(GraphErrorCodes.ERR_INVALID_NODE.toString, "Node Not Found With Identifier : " + identifier)
1Class 2 ServerException 3 assessment-actors (3 usages found) 4 org.sunbird.managers (3 usages found) 5 AssessmentManager.scala (1 usage found) 6 207 } else throw new ServerException("ERR_QUESTION_SET_HIERARCHY", "No hierarchy is present in cassandra for identifier:" + rootNode.getIdentifier) 7 CopyManager.scala (2 usages found) 8 107 throw new ServerException("ERR_QUESTIONSET_COPY", "Something Went Wrong, Please Try Again") 9 116 throw new ServerException("ERR_QUESTIONSET_COPY", "Something Went Wrong, Please Try Again") 10 qs-hierarchy-manager (4 usages found) 11 org.sunbird.managers (4 usages found) 12 HierarchyManager.scala (3 usages found) 13 488 throw new ServerException("ERR_WHILE_FETCHING_HIERARCHY_FROM_CASSANDRA", "Error while fetching hierarchy from cassandra") 14 493 throw new ServerException("ERR_WHILE_FETCHING_HIERARCHY_FROM_CASSANDRA", "Error while fetching hierarchy from cassandra") 15 575 throw new ServerException("SERVER_ERROR", "Invalid response from search") 16 UpdateHierarchyManager.scala (1 usage found) 17 128 throw new ServerException(HierarchyErrorCodes.ERR_HIERARCHY_NOT_FOUND, "No hierarchy is present in cassandra for identifier:" + rootNode.getIdentifier) 18 Maven: org.sunbird:graph-engine_2.11:1.0-SNAPSHOT (9 usages found) 19 src.main.scala.org.sunbird.graph.external.store (5 usages found) 20 ExternalStore.scala (5 usages found) 21 49 throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, "Exception Occurred While Saving The Record. Exception is : " + e.getMessage) 22 92 throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, "Exception Occurred While Reading The Record. Exception is : " + e.getMessage) 23 110 throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, "Exception Occurred While Reading The Record. Exception is : " + e.getMessage) 24 150 throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, "Exception Occurred While Reading The Record. Exception is : " + e.getMessage) 25 181 throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, "Exception Occurred While Saving The Record. Exception is : " + e.getMessage) 26 src.main.scala.org.sunbird.graph.relations (2 usages found) 27 AbstractRelation.scala (1 usage found) 28 66 throw new ServerException(GraphErrorCodes.ERR_RELATION_VALIDATE.toString, "Error occurred while validating the relation", e) 29 SequenceMembershipRelation.scala (1 usage found) 30 25 throw new ServerException(GraphErrorCodes.ERR_RELATION_VALIDATE.toString, e.getMessage, e) 31 src.main.scala.org.sunbird.graph.schema (1 usage found) 32 CategoryDefinitionValidator.scala (1 usage found) 33 65 } else throw new ServerException(resp.getParams.getErr, resp.getParams.getErrmsg + " " + resp.getResult) 34 src.main.scala.org.sunbird.graph.schema.validator (1 usage found) 35 FrameworkValidator.scala (1 usage found) 36 152 throw new ServerException("ERR_GRAPH_PROCESSING_ERROR", "Unable To Fetch Nodes From Graph. Exception is: " + e.getMessage) 37 Maven: org.sunbird:platform-common:1.0-SNAPSHOT (13 usages found) 38 org.sunbird.common (7 usages found) 39 HttpUtil (7 usages found) 40 post(String, Map<String, Object>, Map<String, String>) (2 usages found) 41 33 throw new ServerException("ERR_INVALID_REQUEST_BODY", "Request Body is Missing!"); 42 38 throw new ServerException("ERR_API_CALL", "Something Went Wrong While Making API Call | Error is: " + e.getMessage()); 43 get(String, String, Map<String, String>) (1 usage found) 44 58 throw new ServerException("ERR_API_CALL", "Something Went Wrong While Making API Call | Error is: " + e.getMessage()); 45 getMetadata(String, Map<String, String>) (1 usage found) 46 84 throw new ServerException("ERR_API_CALL", "Something Went Wrong While Making API Call | Error is: " + e.getMessage()); 47 validateRequest(String, Map<String, String>) (2 usages found) 48 90 throw new ServerException("ERR_INVALID_URL", "Url Parameter is Missing!"); 49 92 throw new ServerException("ERR_INVALID_HEADER_PARAM", "Header Parameter is Missing!"); 50 getResponse(HttpResponse<String>) (1 usage found) 51 100 throw new ServerException("ERR_DATA_PARSER", "Unable to parse data! | Error is: " + e.getMessage()); 52 Maven: org.sunbird:schema-validator:1.0-SNAPSHOT (1 usage found) 53 org.sunbird.schema (1 usage found) 54 SchemaValidatorFactory (1 usage found) 55 getExternalStoreName(String, String) (1 usage found) 56 39 throw new ServerException("ERR_KEYSPACE_NOT_DEFINED", "Key space for " + name + " is not configured.");

API Error Responses from inQuiry microservice


API Functionality

HTTP Error Code

Existing Error Response

Question Create

400 Bad Request

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:27:33ZZ", 5 "params": { 6 "resmsgid": "c34e2d4f-779b-49fc-9d6a-db4466c8de3a", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata name not set" 16 ] 17 } 18}

Question Create

400 Bad Request

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:26:17ZZ", 5 "params": { 6 "resmsgid": "e45e51ca-8c4e-4585-ab03-75ab8b131bb5", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata code not set" 16 ] 17 } 18}

Question Create

400 Bad Request

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:26:27ZZ", 5 "params": { 6 "resmsgid": "0020dd04-65ad-4e8a-9194-bb927025d3e0", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata mimeType not set" 16 ] 17 } 18}

Question Create

400 Bad Request

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:51:49ZZ", 5 "params": { 6 "resmsgid": "3814749d-47a0-4e38-a040-6d32e8e4cbcf", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata primaryCategory not set" 16 ] 17 } 18}

Question Create

400 Bad Request

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:26:35ZZ", 5 "params": { 6 "resmsgid": "4ab85c6e-3ee4-4dc3-bcbf-0292b734dfdc", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Metadata mimeType should be one of: [application/vnd.sunbird.question]" 16 ] 17 } 18}

Question Update

400 Bad Request

1{ 2 "id": "api.question.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:29:03ZZ", 5 "params": { 6 "resmsgid": "d43a4913-d662-4a8a-8859-9add9a04da52", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Invalid version Key" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Review

400 Bad Request

1{ 2 "id": "api.question.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:20ZZ", 5 "params": { 6 "resmsgid": "fd89269b-36f9-4673-8af4-db41b5f60716", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [body] Missing for do_21379593928588492814142" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Review

400 Bad Request

1{ 2 "id": "api.question.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:24ZZ", 5 "params": { 6 "resmsgid": "851c2874-e6fe-42b0-8c4f-67c234154bc8", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [responseDeclaration] Missing for do_21379593932446105614143" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Review

400 Bad Request

1{ 2 "id": "api.question.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:29ZZ", 5 "params": { 6 "resmsgid": "23ee2a5c-6ad7-4bae-80c2-94d42f82546d", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [interactions] Missing for do_21379593936168550414144" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Review

400 Bad Request

1{ 2 "id": "api.question.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:34ZZ", 5 "params": { 6 "resmsgid": "3de1955f-c480-4903-ba17-05e59cf2dc43", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [answer] Missing for do_21379593940282572814145" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Publish

400 Bad Request

1{ 2 "id": "api.question.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:56ZZ", 5 "params": { 6 "resmsgid": "3c82e765-b5e0-4fec-8e5e-87d66f60b323", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [body] Missing for do_21379593958717030414146" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Publish

400 Bad Request

1{ 2 "id": "api.question.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:00ZZ", 5 "params": { 6 "resmsgid": "e54e1b92-98a8-46bb-a27c-f9790dffd713", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [responseDeclaration] Missing for do_21379593961955328014147" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Publish

400 Bad Request

1{ 2 "id": "api.question.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:04ZZ", 5 "params": { 6 "resmsgid": "80ab8746-8455-4d62-9bf9-886bd38851d8", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [interactions] Missing for do_21379593964663603214148" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Publish

400 Bad Request

1{ 2 "id": "api.question.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:07ZZ", 5 "params": { 6 "resmsgid": "7ec01a2a-3e35-46d7-8385-0dcc81780708", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [answer] Missing for do_21379593967552921614149" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question List

400 Bad Request

1{ 2 "id": "api.questions.list", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:29ZZ", 5 "params": { 6 "resmsgid": "f76b3bb2-05f0-428a-b0ee-113609f12b6f", 7 "msgid": null, 8 "err": "ERR_BAD_REQUEST", 9 "status": "failed", 10 "errmsg": "Request contains invalid identifiers : [do_list_abc_123]." 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question List

400 Bad Request

1{ 2 "id": "api.questions.list", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:34ZZ", 5 "params": { 6 "resmsgid": "9edb0e68-8a15-4219-a92a-902efcc786ee", 7 "msgid": null, 8 "err": "ERR_BAD_REQUEST", 9 "status": "failed", 10 "errmsg": "Request contains invalid identifiers : [do_list_abc_234, do_list_abc_123]." 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Import

400 Bad Request

1{ 2 "id": "api.question.import", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:00ZZ", 5 "params": { 6 "resmsgid": "b71e805f-5341-4e56-93ed-9f57fd293864", 7 "msgid": null, 8 "err": "ERR_REQUIRED_PROPS_VALIDATION", 9 "status": "failed", 10 "errmsg": "Validation Failed! Mandatory Properties Are [\"name\",\"code\",\"mimeType\",\"framework\",\"channel\"] | Required Property's Missing For [fb1aef22-88e4-4f91-8055-6086bf338bf1]" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Import

400 Bad Request

1{ 2 "id": "api.question.import", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:09ZZ", 5 "params": { 6 "resmsgid": "6a19eeec-b742-4057-a782-c5c1a6a73695", 7 "msgid": null, 8 "err": "ERR_READ_SOURCE", 9 "status": "failed", 10 "errmsg": "Received Invalid Response While Reading Data From Source. Response Code is : RESOURCE_NOT_FOUND" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

Question Reject

400 Bad Request

1{ 2 "id": "api.question.reject", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:19ZZ", 5 "params": { 6 "resmsgid": "1acd73e6-d400-492e-abf5-5654c3425934", 7 "msgid": null, 8 "err": "ERR_QUESTION_REJECT", 9 "status": "failed", 10 "errmsg": "Question is not in 'Review' state for identifier: do_21379594026542694414151" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Create

400 Bad Request

1{ 2 "id": "api.questionset.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:44ZZ", 5 "params": { 6 "resmsgid": "9ce43dcc-49c6-4b19-9285-1e4019bfbf30", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata name not set" 16 ] 17 } 18}

QuestionSet Create

400 Bad Request

1{ 2 "id": "api.questionset.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:53ZZ", 5 "params": { 6 "resmsgid": "6ac7f1cc-a41a-4bf4-a5f7-49f16beece82", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata code not set" 16 ] 17 } 18}

QuestionSet Create

400 Bad Request

1{ 2 "id": "api.questionset.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:56ZZ", 5 "params": { 6 "resmsgid": "6a4dc627-3593-49d5-adcf-d0c0a077cff6", 7 "msgid": null, 8 "err": "CLIENT_ERROR", 9 "status": "failed", 10 "errmsg": "Validation Errors" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": [ 15 "Required Metadata mimeType not set" 16 ] 17 } 18}

QuestionSet Update

200 OK

??

QuestionSet Update Hierarchy

400 Bad Request

1{ 2 "id": "api.questionset.hierarchy.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:44ZZ", 5 "params": { 6 "resmsgid": "948bf8e0-c33c-40ed-8e69-fdecace00b7d", 7 "msgid": null, 8 "err": "ERR_INVALID_ROOT_ID", 9 "status": "failed", 10 "errmsg": "Please Provide Valid Root Node Identifier" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Review

400 Bad Request

1{ 2 "id": "api.questionset.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:05ZZ", 5 "params": { 6 "resmsgid": "f90d747b-be39-4fad-992c-c5e2c8575806", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [responseDeclaration] Missing for do_21379594112953548814163" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Publish

400 Bad Request

1{ 2 "id": "api.questionset.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:33ZZ", 5 "params": { 6 "resmsgid": "25552ef2-1af5-4bbb-80cb-d68b8f229b1f", 7 "msgid": null, 8 "err": "ERR_MANDATORY_FIELD_VALIDATION", 9 "status": "failed", 10 "errmsg": "Mandatory Fields [responseDeclaration] Missing for do_21379594136426086414168" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Retire

400 Bad Request

1{ 2 "id": "api.questionset.retire", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:35:05ZZ", 5 "params": { 6 "resmsgid": "b2e2a370-dee4-47cb-8fe6-a250cdc70f7c", 7 "msgid": null, 8 "err": "ERR_QUESTION_SET_RETIRE", 9 "status": "failed", 10 "errmsg": "QuestionSet with identifier : do_21379594162091622414177 is already Retired." 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Reject

400 Bad Request

1{ 2 "id": "api.questionset.reject", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:38:57ZZ", 5 "params": { 6 "resmsgid": "ff2aac33-c257-487a-85a8-b44a013e2f71", 7 "msgid": null, 8 "err": "ERR_QUESTION_SET_REJECT", 9 "status": "failed", 10 "errmsg": "QuestionSet is not in 'Review' state for identifier: do_21379594343893401614182" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Import

400 Bad Request

1{ 2 "id": "api.questionset.import", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:39:31ZZ", 5 "params": { 6 "resmsgid": "b8a1999b-5893-4ef5-801d-b7c73813119f", 7 "msgid": null, 8 "err": "ERR_REQUIRED_PROPS_VALIDATION", 9 "status": "failed", 10 "errmsg": "Validation Failed! Mandatory Properties Are [\"name\",\"code\",\"mimeType\",\"framework\",\"channel\"] | Required Property's Missing For [4f85db76-f8c4-41d0-b45c-a8cadba2f618]" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Import

400 Bad Request

1{ 2 "id": "api.questionset.import", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:39:36ZZ", 5 "params": { 6 "resmsgid": "45cd3ffc-205e-44cd-8017-40804711aa2a", 7 "msgid": null, 8 "err": "ERR_READ_SOURCE", 9 "status": "failed", 10 "errmsg": "Received Invalid Response While Reading Data From Source. Response Code is : RESOURCE_NOT_FOUND" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Add Children

400 Bad Request

1{ 2 "id": "api.questionset.add", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:39:44ZZ", 5 "params": { 6 "resmsgid": "6f0aa0d2-6d4a-4788-8a22-0c68d8bb841a", 7 "msgid": null, 8 "err": "ERR_BAD_REQUEST", 9 "status": "failed", 10 "errmsg": "children are mandatory" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Remove Children

400 Bad Request

1{ 2 "id": "api.questionset.remove", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:40:01ZZ", 5 "params": { 6 "resmsgid": "242d2006-4e0e-49d8-8edd-725e68fd6a16", 7 "msgid": null, 8 "err": "ERR_BAD_REQUEST", 9 "status": "failed", 10 "errmsg": "children are mandatory" 11 }, 12 "responseCode": "CLIENT_ERROR", 13 "result": { 14 "messages": null 15 } 16}


API Functionality

HTTP Error Code

Existing Error Response

Question Create

404 Not Found

1{ 2 "id": "api.question.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:26:45ZZ", 5 "params": { 6 "resmsgid": "ae6a0c53-2e1b-40fd-8085-7a6463675a5b", 7 "msgid": null, 8 "err": "404", 9 "status": "failed", 10 "errmsg": "Entry is not found in cassandra for content with identifier: obj-cat:random-category-name_question_all {}" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Question Read

404 Not Found

1{ 2 "id": "api.question.read", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:28:25ZZ", 5 "params": { 6 "resmsgid": "f8088bfa-ba98-49d0-ac9b-8cdc4d15f173", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_1111111" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Question Update

404 Not Found

1{ 2 "id": "api.question.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:11ZZ", 5 "params": { 6 "resmsgid": "12a442d1-851b-4bd4-b664-878688497a55", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_abc_123" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Question Review

404 Not Found

1{ 2 "id": "api.question.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:30:41ZZ", 5 "params": { 6 "resmsgid": "6d9184ee-1cb3-4c99-acd8-d05fb764aeca", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_abcq_1234" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Question Publish

404 Not Found

1{ 2 "id": "api.question.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:31:12ZZ", 5 "params": { 6 "resmsgid": "486fabc5-9ca9-40c4-8aa9-48c4c493bc52", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_abcq_1234" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Question Reject

404 Not Found

1{ 2 "id": "api.question.reject", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:32:24ZZ", 5 "params": { 6 "resmsgid": "49b848a4-17d1-43dd-9fe8-508f224dd6f5", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_abc_reject_1111" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Create

404 Not Found

1{ 2 "id": "api.questionset.create", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:04ZZ", 5 "params": { 6 "resmsgid": "6b5f76da-2fbd-433b-9660-1d7913be0db6", 7 "msgid": null, 8 "err": "404", 9 "status": "failed", 10 "errmsg": "Entry is not found in cassandra for content with identifier: obj-cat:test-questionset-category_questionset_all {}" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Read

404 Not Found

1{ 2 "id": "api.questionset.read", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:10ZZ", 5 "params": { 6 "resmsgid": "9322f6f9-da7b-481f-9a67-281403c321f5", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: questionset_123_invalid" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Update

404 Not Found

1{ 2 "id": "api.questionset.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:27ZZ", 5 "params": { 6 "resmsgid": "0f41b47c-7f8d-46dc-87dd-171ef4d8bfb6", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: invalid_questionset_id" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Update Hierarchy

404 Not Found

1{ 2 "id": "api.questionset.hierarchy.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:49ZZ", 5 "params": { 6 "resmsgid": "d63ee9b1-1a49-455a-a9a0-accd6bc5a036", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_12345" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Update Hierarchy

404 Not Found

1{ 2 "id": "api.questionset.hierarchy.update", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:33:54ZZ", 5 "params": { 6 "resmsgid": "c9fdb65f-a071-41b9-a0eb-0f7a160329ee", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_q_123456" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Review

404 Not Found

1{ 2 "id": "api.questionset.review", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:25ZZ", 5 "params": { 6 "resmsgid": "8050b405-6c9f-431a-a5ed-2465bd92aa3d", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_12345" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Publish

404 Not Found

1{ 2 "id": "api.questionset.publish", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:39ZZ", 5 "params": { 6 "resmsgid": "c08b8af9-5b03-47b0-b2be-1a37e840fae0", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_1234_publish" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Read Hierarchy

404 Not Found

1{ 2 "id": "api.questionset.hierarchy.get", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:47ZZ", 5 "params": { 6 "resmsgid": "d229d131-d787-480a-bbfa-2800d59dcb5a", 7 "msgid": null, 8 "err": "RESOURCE_NOT_FOUND", 9 "status": "failed", 10 "errmsg": "rootId do_21379594147649945614172 does not exist" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": {} 14}

QuestionSet Read Hierarchy

404 Not Found

1{ 2 "id": "api.questionset.hierarchy.get", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:34:51ZZ", 5 "params": { 6 "resmsgid": "3dceeaa5-13ad-400a-9470-869017e71239", 7 "msgid": null, 8 "err": "RESOURCE_NOT_FOUND", 9 "status": "failed", 10 "errmsg": "rootId do_qs_123_abc does not exist" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": {} 14}

QuestionSet Retire

404 Not Found

1{ 2 "id": "api.questionset.retire", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:35:17ZZ", 5 "params": { 6 "resmsgid": "995b39d1-87fc-439e-992a-397175f77fb9", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_1234" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Reject

404 Not Found

1{ 2 "id": "api.questionset.reject", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:39:23ZZ", 5 "params": { 6 "resmsgid": "acd9ed0b-3aec-481c-ac52-3476b805f099", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_123445" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Add Children

404 Not Found

1{ 2 "id": "api.questionset.add", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:39:53ZZ", 5 "params": { 6 "resmsgid": "673887df-8c4d-4b84-90d5-874f3868d5ce", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_12333333" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

QuestionSet Remove Children

404 Not Found

1{ 2 "id": "api.questionset.remove", 3 "ver": "3.0", 4 "ts": "2023-05-14T14:40:07ZZ", 5 "params": { 6 "resmsgid": "015b90c2-bb4c-4a24-a270-dba2acf21538", 7 "msgid": null, 8 "err": "NOT_FOUND", 9 "status": "failed", 10 "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_qs_1111223333" 11 }, 12 "responseCode": "RESOURCE_NOT_FOUND", 13 "result": { 14 "messages": null 15 } 16}

Proposed Error Response

Solution 1

Recommendation is to use the error standards as specified in the

http://jsonapi.org

code: an application-specific error code, expressed as a string value.

title: a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.

detail: a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.

source: an object containing references to the primary source of the error. It SHOULD include one of the following members or be omitted:

pointer : a JSON Pointer to the value in the request document that caused the error

parameter: a string indicating which URI query parameter caused the error.

header : a string indicating the name of a single request header which caused the error.


1{ 2 "errors": [ 3 { 4 "code": "1000", 5 "source": { "pointer": "name" }, 6 "detail": "Required Metadata name not set." 7 }, 8 { 9 "code": "1001", 10 "source": { "pointer": "code" }, 11 "detail": "Required Metadata code not set." 12 }, 13 { 14 "code": "1002", 15 "source": { "pointer": "mimeType" }, 16 "detail": "Required Metadata mimeType not set." 17 } 18 ] 19}


We can reserve error codes for the parent category of errors, something like outlined below,

CLIENT_ERROR - 10000 to 20000

RESOURCE_NOT_FOUND - 20001 to 30000

SERVER_ERROR - 30001 to 40000

The Error class will be part of knowlg core

Sample code for exception,

1throw new ClientException("ERR_INVALID_REQUEST", "A summary of the error", listOfErrors;

Solution 2

Preparing a key / value of the field with the error and corresponding message.

1{ 2 "errors": { 3 "name" : "Required Metadata name not set.", 4 "code" : "Required Metadata code not set.", 5 "mimeType" : "Required Metadata mimeType not set." 6 } 7}


One limitation with this approach is if there are multiple errors to be returned on the same field, then it becomes difficult.

Sample code for exception,

1throw new ClientException("ERR_INVALID_REQUEST", "A summary of the error", mapOfErrors);

Proposed Error Category and Definitions

ClientException - Can the client recover from an error by fixing the error and resubmitting?

ResourceNotFoundException - The resource that is requested by the client is not found in the server. Client can recover from this error by correcting the mistake if possible.

ServerException - May be a external API call failed. Nothing for the client to fix an resubmit, but in some case can be retried

Recheck if we are using the right exception in the right context

Error Category

HTTP Error Code

Error Sub Category

Error Code

Scenarios Applicable

ERR_INVALID_REQUEST

400

ERR_MANDATORY_FIELD_MISSING


Mandatory attributes are missing or missing values

  • Mandatory fields missing

  • Required fields are not passed

  • Some examples

    • Identifier missing

    • rootId missing

    • childrens are not given

ERR_INVALID_REQUEST

400

ERR_INVALID_PROPERTY_SUPPLIED

1000

When property is invalid or given in wrong place in the request

  • The property inside the request pay load is not recognised by the server

  • The property given is restricted for usage

  • Schema validation errors detected on the properties

  • Some examples

    • Questions requested with children in hierarchy

ERR_INVALID_REQUEST

400

ERR_INVALID_VALUE_SUPPLIED


Request has an invalid value when validating

  • Any validation errors detected on the value supplied

  • Some examples

    • Channel id not matching

    • Identifier supplied is not valid

    • Value supplied is not valid for the key

    • More values supplied than the limit

    • Incorrect children values supplied

    • Invalid identifiers

    • Invalid mimeType

ERR_INVALID_REQUEST

400

ERR_VALUE_CANNOT_BE_EMPTY

1001

In case of conditionally required and not always mandatory

  • Not defined as mandatory, but conditionally needs a value


400

ERR_OPERATION_NOT_PERMITTED


Errors due to the current state of the resource

  • Question visibility is private

  • Question Visibility cannot be Parent

  • Channel id not matching

  • Updating individually for an item whose visibility is parent

  • Sending for a review individually for an item whose visibility is parent

  • Branching logic not expected

  • Invalid visibility


400

ERR_RESOURCE_STATE_INVALID


State or status of the resource is not in the desired form for carrying out the current operation

  • An Object Can't Depend On More Than 1 Object

  • A Dependent Object Can't Have Further Dependent Object

  • Invalid Relation Object Found.

  • Dependent Children Found!

ERR_RESOURCE_NOT_FOUND

404

ERR_RESOURCE_NOT_FOUND


The requested resource is not found in the server

  • Nodes doesn’t exist with the given identifier

  • Source With Identifiers not found

  • Content not found

  • No hierarchy found in Cassandra

ERR_SERVER_EXCEPTION

500

ERR_API_CALL


Exception occurred while making API calls

ERR_SERVER_EXCEPTION

500

ERR_JOB_SUBMISSION


Exception occurred when submitting the jobs

  • Kafka event was not generated properly

ERR_SERVER_EXCEPTION

500

ERR_DATA_STORE


Exception occurred while performing operation against the various data stores

ERR_SERVER_EXCEPTION

500

ERR_DATA_PARSING


Exception occurred while parsing the input data

ERR_SERVER_EXCEPTION

500

ERR_SYSTEM_EXCEPTION


Other exception occurred in the server side