fiware-orion icon indicating copy to clipboard operation
fiware-orion copied to clipboard

Partial success HTTP status codes

Open jmcanterafonseca opened this issue 7 years ago • 9 comments

for certain entity update operations, for instance, append attributes in strict mode, if one or more of the concerned attributes already exist, the operation will end up with a 422 error code, but any non-existent attribute will have been added to the entity. i.e something went well, something went bad ...

Status code 422 could be changed by another HTTP status code that gives information to the client that the operation had a partial success, i.e. something went well but not all

see

https://stackoverflow.com/questions/8472935/http-status-code-for-a-partial-successful-request

jmcanterafonseca avatar Nov 30 '17 09:11 jmcanterafonseca

Hi @jmcanterafonseca & @fgalan Sir I would like to work on this issue. Please assign this issue to me if it still needs to be fixed.

rajeswar-NEC avatar Aug 24 '21 16:08 rajeswar-NEC

@rajeswar-NEC thank you for your willingness to work in this issue! You have been assigned.

However, before modifying the code to solve it, we should decide which HTTP code should be used instead of 422. I have had a look to the reference https://stackoverflow.com/questions/8472935/http-status-code-for-a-partial-successful-request but it's not clear to me which one should be used.

fgalan avatar Aug 26 '21 11:08 fgalan

Hi @fgalan sir, Due to medical reason @rajeswar-NEC is not able to work on this issue. I will work on this issue in future and will try to analyzing this issue.

Anjali-NEC avatar Oct 04 '21 12:10 Anjali-NEC

Hi @fgalan Sir,

However, before modifying the code to solve it, we should decide which HTTP code should be used instead of 422. I have had a look to the reference https://stackoverflow.com/questions/8472935/http-status-code-for-a-partial-successful-request but it's not clear to me which one should be used.

Please confirm which HTTP code should be used instead of 422. So that I will try to fix this issue

Anjali-NEC avatar Oct 19 '21 07:10 Anjali-NEC

Please confirm which HTTP code should be used instead of 422.

Do you have any proposal for the new code to be used?

fgalan avatar Oct 19 '21 12:10 fgalan

Do you have any proposal for the new code to be used?

As per my understanding we should use HTTP 207 Multi-Status code. https://stackoverflow.com/questions/30571489/what-are-applicable-scenarios-in-using-http-status-207-in-rest-api

Anjali-NEC avatar Nov 07 '21 19:11 Anjali-NEC

Not sure if 207 is the proper one...

As far as I have checked, 207 belongs to the WebDAV extension to HTTP and involves a specific response payload in XML, described at https://datatracker.ietf.org/doc/html/rfc4918#section-13

The default Multi-Status response body is a text/xml or application/xml HTTP entity with a 'multistatus' root element

That's not compatible with the responses generated by Orion.

Anyway, if choosing the right HTTP code is taking time and blocking this issue, maybe what we can do is to use a #define directive to pick someone now (for instance, that 207) and later to adjust to the definitive one.

fgalan avatar Nov 08 '21 11:11 fgalan

Anyway, if choosing the right HTTP code is taking time and blocking this issue, maybe what we can do is to use a #define directive to pick someone now (for instance, that 207) and later to adjust to the definitive one.

I have fixed this issue by picking HTTP code 207 and raise PR for the same. Please review my PR #4003 if it is Ok then please merge it into master

Anjali-NEC avatar Nov 15 '21 10:11 Anjali-NEC

@fgalan Gentle reminder !!

Anjali-NEC avatar Nov 29 '21 05:11 Anjali-NEC

Hi @fgalan, I'm working on it, and soon I will upload a diff.

chetan-NEC avatar Jan 09 '23 05:01 chetan-NEC

This issue is going to be closed. Rationale here: https://github.com/telefonicaid/fiware-orion/pull/4266#issuecomment-1425992547

fgalan avatar Feb 14 '23 08:02 fgalan