Answered by:
Have a simple question about WEB API

Question
-
User611346789 posted
Hello everyone,
I have a simple question which is asked by someone. The question is Suppose i have sent a POST request to a 3'rd Party API and any how we know the Transaction is completed. But the 3'rd party API does not response any things. No response like ok or failed. Then what should i show to my client from my Side. And is there any situation to be happen like this and what should i do in this scenario.
Thanks in advance
Thursday, February 28, 2019 3:21 PM
Answers
-
User753101303 posted
Hi,
AFAIK it is just not possible given how http works. For example https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/action-results tells that if you return "void" you are actually still sending back a 204 no content response.
Waht I could imagine is the server taking a very long time to respond and you should end up then with a client side timeout (maybe after having increased first the server side timeout)...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 28, 2019 4:36 PM -
User475983607 posted
Hello everyone,
I have a simple question which is asked by someone. The question is Suppose i have sent a POST request to a 3'rd Party API and any how we know the Transaction is completed. But the 3'rd party API does not response any things. No response like ok or failed. Then what should i show to my client from my Side. And is there any situation to be happen like this and what should i do in this scenario.
Thanks in advance
There is always an HTTP response from an HTTP request. It's how the protocol works.
No response from an HTTP request could indicate a firewall issue. The most likely cause is a code bug.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 28, 2019 4:51 PM
All replies
-
User753101303 posted
Hi,
AFAIK it is just not possible given how http works. For example https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/action-results tells that if you return "void" you are actually still sending back a 204 no content response.
Waht I could imagine is the server taking a very long time to respond and you should end up then with a client side timeout (maybe after having increased first the server side timeout)...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 28, 2019 4:36 PM -
User475983607 posted
Hello everyone,
I have a simple question which is asked by someone. The question is Suppose i have sent a POST request to a 3'rd Party API and any how we know the Transaction is completed. But the 3'rd party API does not response any things. No response like ok or failed. Then what should i show to my client from my Side. And is there any situation to be happen like this and what should i do in this scenario.
Thanks in advance
There is always an HTTP response from an HTTP request. It's how the protocol works.
No response from an HTTP request could indicate a firewall issue. The most likely cause is a code bug.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 28, 2019 4:51 PM -
User611346789 posted
Thanks everyone. I was also know that HTTP request must return something. But one of Interviewer ask me over 10 times that what should i use if nothing return. Then i become confused that am i missing something's or not.
Thanks all again.
Thursday, February 28, 2019 5:02 PM -
User753101303 posted
Ah ! It's always hard to understand what an interviewer really wants ;-) I I always wonder if it could be to see if you are self confident or how you discuss an issue with someone that disagree or even that is just wrong, rather than really about the technical side ?
My response would be likely :
- I DO expect a response with a success status code. I consider anything else as an error
- I DO expect not having a response triggers a timeout with a failure status code (causing this to be handled as any other error)
- would show I consider his opinion by asking what he expects and either agree if I REALLY forgot about something or telling the best bet would be to test "what happens" (not "who is right or wrong")
I saw once in a forum a talented SQL guy but that looked down everyone (basically "you are doing it all wrong, do exactly what I tell which is the only valid solution to your problem etc"). It might worth to detect this in an interview as despite his real knownledge, having this guy in a team is likely a real nightmare.Thursday, February 28, 2019 6:53 PM