-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Functionally, while the current API supports returning calculations and uses the HTTP response code to determine the success or failure of any given calculation, however when the POST method is used, an array of asset objects can be sent to the API and any one of the objects can result in an error.
Rather than return a single HTTP response code of 500 or 422 with no asset response objects, the POST API should support returning a list of all valid calculations possible and return a status code for each object so that valid calculations are returned as Asset Objects with some status code and text denoting the calculation succeeded. Any invalid calculations should return an Asset Object with the originally requested content and a status code and text denoting what was invalid about the calculation.
Ideally change the Asset Objects being returned by the POST response method to include:
- All inputs provided in the request for the array of Asset objects requested.
- A numeric code similar to the HTTP response code that would have been returned.
If no error occurred in calculating an asset in the Array:
- The response should be similar to what it currently is now,
- Just adding the numeric code element returning a response of 200.
If an error DID in fact occur when calculating an asset in the Array
- The response should be similar to what it currently is now.
- A numeric code element should be returned in the response of 422 or 500 should be returned based on the logic in ExceptionMiddleware.cs.
- The response should return Text describing what error occurred in the calculation as provided by the logic in ExceptionMiddleware.cs.
The HTTP response code should be changed to represent the fact that some, but not all of the assets were calculated correctly if an error occurred in any of the Asset object calculations. Therefore, a HTTP response code of 200 should only be returned when all assets were calculated correctly and some other industry standard variant of code 200 should be returned when one or more errors occurred.