This commit is contained in:
@@ -125,7 +125,7 @@ Here is an example of a more detailed error response showing validation errors o
|
||||
{
|
||||
"message": "255 max",
|
||||
"target": "Name",
|
||||
"error": "LengthExceeded"
|
||||
"error": "2202"
|
||||
},
|
||||
{
|
||||
"target": "EndDate",
|
||||
@@ -147,7 +147,7 @@ The above example shows multiple validation errors ([API error code](api-error-c
|
||||
|
||||
`target` property shows the location of the error. The value of `target` is either a property name corresponding to the property that failed business rule validation or blank if the validation rule applies to the entire object in general.
|
||||
|
||||
`error` property contains the exact [validation error](api-validation-error-codes.md).
|
||||
`error` property contains the exact [api validation error code](api-error-codes.md).
|
||||
|
||||
`message` property optionally contains further information of use to the developer, in the example above you can see that the name property has more than the maximum limit of 255 characters.
|
||||
|
||||
@@ -219,4 +219,4 @@ Internal server errors are returned with an HTTP Status Code of 500 and an error
|
||||
|
||||
For security reasons no details of an internal server exception are returned, you must examine the [server log](common-log.md) to see the details.
|
||||
Generally this means the request triggered an unhandled exception which will be logged in detail to the log file.
|
||||
Please report any internal server errors (preferrably with the log showing the exception details) to AyaNova support so we can look into it.
|
||||
Please report any unexpected internal server errors (preferrably with the log showing the exception details) to AyaNova support so we can look into it.
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# API VALIDATION ERROR CODES
|
||||
|
||||
All the validation error codes that can be [returned](api-response-format.md) by the API server.
|
||||
In each case there may be more details in the `message` property where appropriate.
|
||||
|
||||
| CODE | MEANING |
|
||||
| ----- | ------------------------------ |
|
||||
| RequiredPropertyEmpty | An AyaNova fixed rule required property value is empty |
|
||||
| CustomRequiredPropertyEmpty | A user customized form property set to required has an empty value |
|
||||
| RequiredPropertyMissing | Required property is missing entirely |
|
||||
| LengthExceeded | A text property has more characters than are allowed. The limit will be returned in the `message` property of the validation error |
|
||||
| NotUnique | A text property is required to be unique but an existing identical value was found in the database |
|
||||
| StartDateMustComeBeforeEndDate | When an object requires a start and end date the start date must be earlier than the end date |
|
||||
| InvalidValue | Generic error indicating an input object's property is not set correctly |
|
||||
| ReferentialIntegrity | Indicates modifying the object (usually a delete) will break the link to other records in the database. The other records need to be modified before continuing |
|
||||
| InvalidOperation | Indicates the operation is invalid, details provided in the `message` |
|
||||
| NotChangeable | Indicates the attempted property change is invalid because the value is fixed and cannot be changed |
|
||||
@@ -36,5 +36,4 @@ pages:
|
||||
- 'API request format': 'api-request-format.md'
|
||||
- 'API response format': 'api-response-format.md'
|
||||
- 'API error codes': 'api-error-codes.md'
|
||||
- 'API validation error codes': 'api-validation-error-codes.md'
|
||||
- 'API upload routes': 'api-upload-routes.md'
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
Error.Details = new List<ApiDetailError>();
|
||||
foreach (ValidationError v in errors)
|
||||
{
|
||||
Error.Details.Add(new ApiDetailError() { Target = v.Target, Message = v.Message, Error = v.Code.ToString() });
|
||||
Error.Details.Add(new ApiDetailError() { Target = v.Target, Message = v.Message, Error = ((int)v.Code).ToString() });
|
||||
}
|
||||
log.LogDebug("BadRequest - Validation error");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user