Skip to main content
Software Engineering

Questions tagged [http-response]

The tag has no summary.

Filter by
Sorted by
Tagged with
1 vote
1 answer
478 views

How to handle different json response for the same api rest endpoint and different http status

I have an endpoint similar to GET ../produtcs/123 where 123 stands for an ID. The REST service response with either status 200 and a json object A {"deliveryData": {"status": 200, ...
1 vote
0 answers
216 views

What is a forged redirect? (in the context of javascript's fetch API)

I'm trying to make sense of the docs located at: https://developer.mozilla.org/en-US/docs/Web/API/Response/redirected It says Note: Relying on redirected to filter out redirects makes it easy for a ...
4 votes
2 answers
6k views

What's the proper response when I try to update an existing entity but with not found parent ID

I have an update API (PUT/PATCH) entity/{id} to update a certain entity in my DB. Let's say: entity { id: number, // Primary key, unique, not null content: text, parentId: number // Foreign key, ...
0 votes
1 answer
574 views

HTTP error 404 or 500 from an internal call to a separate API?

I have an endpoint in API 1 (my api) that queries API 2 (another companies api) to view and edit objects stored in API 2's database. API 1 is essentially acting as a wrapper service around API 2, ...
4 votes
3 answers
1k views

Error or not error?

I need to implement the following scenarios at the server: User sent too many answers in a given amount of time, for example, it can't submit more than 3 posts within an hour. User sent answer with ...
-1 votes
3 answers
4k views

What HTTP response to return for a patch request with partially correct and partially wrong

I have a campaign, which has URL as a child. If I make a patch request to add a list of 3 URLs out of which first one is invalid URL, second URL already exists in the campaign and we do not want to ...
-2 votes
2 answers
3k views

Which HTTP status to return if a downstream service I depend on returned 500 error

My service B is part of a chain of services and calls a downstream service C. A --> B --> C Service C is returning HTTP 500 errors for any error it faced, including bad requests or input ...
57 votes
7 answers
14k views

Why do so many standards for JSON API response formats contain a "success" property in the response body instead of just using HTTP status codes?

I was researching about best practices for standardised JSON response formats for APIs, according to various sources available online general consensus looks something like this: //Successful request:...
1 vote
3 answers
4k views

Is a 422 response ever appropriate for a GET request?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content ...
jcollum's user avatar
  • 229
2 votes
1 answer
528 views

REST - different response from same resource dependent on requester

Let's say I have a single resource of employee that belongs to user: { "id": 1, "name": "John Doe", "userId: 1 } When making a GET request to /employees/1, I'm ...
-1 votes
1 answer
725 views

Should I use http status code 402 in my api specification for api methods that allow payment?

According to the MDN the http protocol has the 402 status code: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses And is used for methods that require payment. Also RFC ...
-1 votes
2 answers
2k views

What's the most appropiate http status code for 'not possible' or 'not available' [closed]

I am working on a booking app where I need to book appointments, I want to return the most appropriate HTTP code that says that the booking slot wanted by the user is not available, that it's not ...
-1 votes
2 answers
722 views

API: should a problem with data be announced by a HTTP code or in the response body?

After years of (amateur, dirty) personal API development I finally decided to follow some best practices. My problem: the API may have problems, say, retrieving some data. It will gracefully handle ...
-5 votes
1 answer
6k views

Is it a good practice to return a map or list as HTTP response

The result of processing an HTTP request consists of mappings. Each mapping is from an order number to an object. Is it a good practice to return this as an HTTP response whose body is a Map<String,...
5 votes
4 answers
7k views

HTTP POST request status 200 vs 204 vs 404

Our POST API takes in an identifier (let's say deviceId) in order to compute the accuracy of the location we have stored for that device in a DB; the result of that compution is then saved in a ...

15 30 50 per page
1
2 3 4 5

AltStyle によって変換されたページ (->オリジナル) /