I have a POST request that require a user id. If that user id is found, then everything is successfully is carried out and the default http code is returned (i.e. 200). If the user id is not found, what should I return? Non of the 4xx seem to fulfill my case.
Which HTTP Status code should indicate failed to carry out some code due to invalid input?
196 Views Asked by AudioBubble At
1
There are 1 best solutions below
Related Questions in HTTP
- Handling both JSON and form values in POST request body with unknown values in Golang
- Why can't I use PUT requests?
- nginx set up reverse proxy from subfolder to a port
- Async Web Server RP2040 returning ERR_CONNECTION_REFUSED?
- Getting `FormatException: Missing extension byte (at offset 6)` exception for accessing `response.body` from a server deployed in Vercel
- Retrieving list of values from MYSQL data base based on input value(LARAVEL 10 )(GET HTTP METHOD)
- Unable to add request headers via CHttpFile - C++/MFC
- Why do we call all http services 'Web Api/Web Service'?
- How to correctly read POST REQUEST body on ESP32?
- on linux gitclone issue remote server error showing fatal error with proxy n port
- Elasticsearch - cascading http inputs from Airflow API
- How to clean the html pages opened in a session?
- UTF-8 is not a valid encoding name
- I dont get the Result i expected when i want to get my Telegram Chatbot id
- NextJS 14 SSE with TransformStream() sending messages in a single response
Related Questions in HTTP-STATUS-CODES
- Polly v8 - Retrying specific status codes using the PredicateBuilder
- How repeat a proxy server with a checksite after a failed
- How to handle 4xx status codes in auto-tests
- HttpStatusCode in Spring Boot 3
- What is causing my python script using Google APIs to throw a status code 3 & 6?
- HTTP response code when trying to associate an item with another but is already associated
- How does HTTP redirect work with HTTP methods?
- How to return status code 200 instead of 403 the default URL of my asp net framework application
- How to get status_code from an exception object
- appropriate HTTP status code for non-existent resources in REST API?
- axios give me error (POST /api/v1/users/token/refresh/ HTTP/1.1" 401 65) , How solve it?
- Does HTTP have a "not ready yet" response code?
- How to access http status in Azure Function v4
- Http Status must not be null error how to solve that error
- When loading an image in JavaScript fails, how can you retrieve the specific error or HTTP status codes?
Related Questions in HTTP-STATUS
- how to return only HTTP Status code, if we hit one pre-defined endpoint
- Check IMG URL status (PHP get_headers)
- Which HTTP status should I return if the client tries to upload a new file while server is still processing the previous one?
- Which is the proper response code for this scenario - 207 vs 400 status code
- Correct http status for invalid config in request body?
- HTTP status code for an expired confirmation code
- NestJS - Cannot set headers after they are sent to the client
- My TeaMaster9001 is responding with code 418 whenever I send a brew-coffee request
- REST API response status code - search GET that returns a single result
- What http status should I send for a malformed json response?
- HTTP status quote when a resource can't be inserted but could be fixed by the client
- How to force Spring Boot to set correct HTTP status code to error response?
- Is there any possibility to get status code i.e. (200,301,302) after loading html page in CefSharp C#?
- Detecting 413 (or other HTTP Status) in PHP
- How do I force Nancy to use application/json Response for Integers? Nancy assumes them to be StatusCode
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
But how is this id sent to the server?
Your question lacks plenty of details on what you are trying to achieve, so it's tricky to suggest something. But here are some scenarios I can think of:
If a representation for the resource with the given identifier sent in the URI cannot be found, then
404would be the proper choice.If the value of a query parameter is invalid (like if the server expects an integer but an alpha character is given) and the request cannot be processed because of it, then
400would be suitable.If an invalid value has been sent as part of the body of the request (like if a validation fails or the expected value is missing) and the request could not be processed because of it, then you should consider
422.