I do not think 422 is correct for issues with response. Usually 4XX errors
used to indicate client/request errors. In this case its error or issue
with backend. And for client it can consider as internal server error as
well. Or we can indicate content related issue. 5XX response would be
better. But to be honest i do not have other good suggestion :(

Thanks,
sanjeewa.

On Wed, Jan 9, 2019 at 8:21 PM Harsha Kumara <[email protected]> wrote:

> +1 we should use 422.
>
> [1]
> https://www.quora.com/Which-HTTP-code-is-best-suited-for-validation-errors-400-or-422
> [2]
> https://stackoverflow.com/questions/1959947/whats-an-appropriate-http-status-code-to-return-by-a-rest-api-service-for-a-val
>
> On Wed, Jan 9, 2019 at 3:22 PM Uvindra Dias Jayasinha <[email protected]>
> wrote:
>
>> I think 422 is the most appropriate given your use case of validating if
>> a message matches a given schema. So you can receive a valid JSON or
>> XML(it's not malformed hence it is not a bad request(400)), but it may not
>> match with the message schema definition you are matching against.
>>
>> The specs dont seem to talk about processing from the perspective of the
>> response. I guess you can use the same code used for the request.
>>
>> On Wed, 9 Jan 2019 at 14:54, Shalki Wenushika <[email protected]> wrote:
>>
>>> Hi all,
>>>
>>> This is related to the mail thread subjected as “[Architecture]API
>>> schema based request/response validator for Microgateway”. I’m validating
>>> requests/responses coming to the microgateway and send error messages to
>>> the client if the request/response is invalid.
>>>
>>> When a client sends a request to the microgateway if the request is
>>> invalid I’m sending an error message with the HTTP status code
>>> 422(Unprocessable entity) to the client. And also I’m doing the response
>>> validation. If the response coming from the backend is invalid I send an
>>> error message to the client. I need to know what will be the most
>>> appropriate HTTP status code to be included in the error if the response is
>>> invalid.
>>>
>>> Thank you!
>>>
>>> --
>>>
>>> *Shalki Wenushika*
>>> *Software Engineering Intern*
>>> WSO2  (University of Moratuwa)
>>> *mobile *: *+94 716792399* |   *email *:
>>> <http://c.content.wso2.com/signatures/wso2-signature-general.png>
>>> [email protected]
>>>
>>>
>>>
>>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 777733962
>>
>
>
> --
>
> *Harsha Kumara*
>
> Associate Technical Lead, WSO2 Inc.
> Mobile: +94775505618
> Email: [email protected]
> Blog: harshcreationz.blogspot.com
>
> GET INTEGRATION AGILE
> Integration Agility for Digitally Driven Business
>


-- 
*Sanjeewa Malalgoda*
Software Architect | Associate Director, Engineering - WSO2 Inc.
(m) +94 712933253 | (e) [email protected] | (b) Blogger
<http://sanjeewamalalgoda.blogspot.com>, Medium
<https://medium.com/@sanjeewa190>

GET INTEGRATION AGILE <https://wso2.com/signature>
Integration Agility for Digitally Driven Business
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to