Skip to main content

Questions tagged [http-response]

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

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, ...
surfmuggle's user avatar
1 vote
0 answers
227 views

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 ...
PHP Guru's user avatar
  • 111
4 votes
2 answers
6k views

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, ...
Leo von Barbarosa's user avatar
0 votes
1 answer
595 views

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, ...
Hazzinator's user avatar
4 votes
3 answers
1k views

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 ...
Anatoly's user avatar
  • 274
-1 votes
3 answers
4k views

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 ...
Akshay Vijay Jain's user avatar
-2 votes
2 answers
3k views

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 ...
riorio's user avatar
  • 519
57 votes
7 answers
15k views

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:...
Šime's user avatar
  • 689
1 vote
3 answers
4k views

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
552 views

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 ...
paddyfields's user avatar
-1 votes
1 answer
743 views

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 ...
Dimitrios Desyllas's user avatar
-1 votes
2 answers
2k views

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 ...
nermineslimane's user avatar
-1 votes
2 answers
748 views

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 ...
WoJ's user avatar
  • 1,661
-5 votes
1 answer
6k views

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,...
jerry.pepper's user avatar
5 votes
4 answers
7k views

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 ...
CoderGuy's user avatar
  • 169
0 votes
1 answer
74 views

Given a website, our customers will pick a spot on their website and we record an xpath to that location. Our software is DNS integrated, similar to cloudflare, and we manipulate the origin's html ...
ericraio's user avatar
0 votes
1 answer
1k views

Context Typical restful CRUD service, including PATCH method, whose API validates fields (eg the "name" field may not contain digits). However, data in the database (from backdoor ETL load) ...
Bohemian's user avatar
  • 2,076
-1 votes
2 answers
2k views

I have an API whose job is to aggregate resources obtained by calling multiple other APIs and then give out the aggregated response to the client. Currently even if one or more dependent API calls ...
Kunal gupta's user avatar
41 votes
4 answers
12k views

Over the years, I have seen quite a few questions on this site along the lines of "can I invent my own HTTP response codes"? Generally asked by those who are developing both the server and client. The ...
Mawg's user avatar
  • 4,308
5 votes
1 answer
1k views

It seems 5 years ago there was a proposal for a HTTP SEARCH request, but it does not appear to have been adopted and it not widely supported. Are there any factual documents or citations which shed ...
chrispepper1989's user avatar
12 votes
1 answer
9k views

Let's assume we have an Entity { "id": 1 "inProgress": true, } We have endpoints: /api/v1/entities/ for fetching all entities, /api/v1/entities/1 for fetching entity with id = 1 /api/v1/...
Maxian Nicu's user avatar
1 vote
1 answer
441 views

Let's consider the following scenario. I need to access a resource hosted on server X. I want to get this resource in a Y format, so along with my request I send the Accept: Y header. Unfortunately X ...
Opal's user avatar
  • 275
3 votes
1 answer
915 views

I have a NodeJs backend that interacts with MySQL database. Let us assume that I have a schema similar to this: Book id name Author id book_id name So, I have two tables named Book and ...
Amir Saleem's user avatar
-1 votes
2 answers
215 views

tl;dr Which is the best server response for an endpoint to get a user's age? 30 or {"age":30} or {"metadata":{"time":1561919615,"status":200},"age":30} or something else? I am writing a server using ...
Evorlor's user avatar
  • 1,563
0 votes
2 answers
1k views

I have a design dilemma in deciding the response status code and architecture for a middleware we are designing. So the Client Calls MiddleWare, And middleware calls the 3rd party service to get car-...
Pranay Jaiswal's user avatar
4 votes
2 answers
2k views

By default, the HTTP response code for "file not found" has always been 404. I never really thought about it until recently someone was saying that if the missing file is part of an application then ...
imel96's user avatar
  • 3,608
-2 votes
2 answers
106 views

I design and works on lot of projects involves REST APIs. But one question is always occur to me if it is acceptable way to do REST. So according to REST manuals online, REST is build upon two major ...
kuldeep.kamboj's user avatar
1 vote
0 answers
537 views

I've the following project structure (simplified): domain dto view In domain model is kept. dto classes are used to pass data from domain to view. And in view I've a controller and a handful of *req, *...
Opal's user avatar
  • 275
4 votes
2 answers
799 views

Given a system of services and a reverse proxy, such that requests may either be conclusively processed by the proxy or ultimately handled by any of the services behind the proxy. Consideration has ...
Igwe Kalu's user avatar
  • 103
1 vote
1 answer
3k views

I have a mobile app and an API. The mobile app is set up to expect back a DTO from the API but has no information if an request was unsuccessful. This needs to be updated so that better messaging is ...
DFord's user avatar
  • 1,250
49 votes
11 answers
93k views

I am working with a REST API which resides on a server that handles data for a multitude of IoT devices. My task is to query the server using the API to collect specific performance information about ...
JYelton's user avatar
  • 734
1 vote
2 answers
2k views

We have ServiceA with these endpoints defined: /devices: get: queryParameters: make: type: string repeat: false required: false model: type: string ...
sdoca's user avatar
  • 679
0 votes
2 answers
2k views

I've been struggling with this issue for a while. Let's say you have a business application that has a rich domain and in one of the front-end views you show a list of open Orders. In this view you ...
Mekswoll's user avatar
  • 361
3 votes
3 answers
643 views

I know that if user is forbidden in an admin's area, I should return 401 or 403 status error code. However, what I want to prohibit an admin for accessing a user's dashboard also? An admin has its own ...
Kakki's user avatar
  • 83
3 votes
1 answer
128 views

A user uploads a CSV to the server to be inserted into the database and I would like to return a meaningful response to this user. My thoughts : { inserted : x records discarded : y records } ...
Oleg's user avatar
  • 181
0 votes
1 answer
1k views

We have a graph that shows bandwidth usage over time. The bandwidth is returned from the server in bytes. We need to decide which units to show in the graph in case there are several different ...
TheUnreal's user avatar
  • 109
71 votes
6 answers
83k views

I'll describe an example: I start making an API for a baking shop. The API will allow people to search their catalogus for baking products, such as home-made minty chocolate chip cookies using api....
Berry M.'s user avatar
  • 839
3 votes
0 answers
1k views

I develop mobile apps, now im working on a very big project building a tool for the employees to be heavily used. Now the app is on development mode, and testing with few users, but will need to be ...
manuelBetancurt's user avatar
5 votes
4 answers
2k views

Upon inspecting Twitter's URL shortening service http://t.co, I noticed that, instead of redirecting to the goal URL using a Location HTTP header and a 3xx HTTP status code, it redirects using the ...
Decent Dabbler's user avatar
1 vote
2 answers
1k views

In the old days we used to create a single .gif file for the entire application to avoid too many trips from the browser to the server. Similarly, we used to combine different types of information in ...
ps0604's user avatar
  • 113
1 vote
2 answers
3k views

Should an error 500 only be thrown by the web server, or is it acceptable for your program to throw one itself? try { some bad code; } catch (Exception) { set_header_code(500); set_content_type('...
CJ Dennis's user avatar
  • 669
7 votes
2 answers
202 views

Is it weird to have an identifier such as (_id) on a request which you send to the API, which "enriches" the request and sends back a response with the same identifier (but obviously more enriched ...
Avetis's user avatar
  • 1,534
0 votes
1 answer
1k views

We have authorization server which is in charge of checking token validity, expiration etc. Which HTTP status code should be returned if the authorization server is down? Should it be 401 with "...
Robert's user avatar
  • 555
4 votes
4 answers
927 views

Assuming I create a RESTful web service that looks up a user in a database given the id as a parameter. If the user does not exist, should I return a 404 response (because user not found)? Or a 200 ...
mpmp's user avatar
  • 861
6 votes
3 answers
3k views

In MVC usually the controller sets whatever needs to be sent back to the client/View, including HTTP status code, e.g.: class Controller { public function get(Request req, Response resp) { ...
imel96's user avatar
  • 3,608
2 votes
0 answers
1k views

I am building a package that implements native-like sessions in a PSR7 middleware architecture. I created a middleware which is responsible to create and persist a session cookie. The session is also ...
nebulousGirl's user avatar
0 votes
2 answers
3k views

I need an idea or concept how to reduce http request. Conditions: 1000s of users(android/iphone) active 100s of small images (150kb/image) to be fetched Simply by giving each image a hardcoded link, ...
Sujeet's user avatar
  • 125
3 votes
2 answers
3k views

I am designing a REST api backend that is meant to be consumed by a javascript front-end. I am not sure how to communicate server-side business logic errors (e.g. a user trying to retrieve his ...
balteo's user avatar
  • 191
2 votes
3 answers
789 views

I have been thinking what could be the fastest way to show base64/img data to the user, i could generate the data when the user is registered and then store it to database, or generate it every time ...
Oscar Reyes's user avatar
6 votes
3 answers
3k views

We're looking at creating a web services/REST API layer that will be consumed by web and mobile clients. To make the solution more robust I was considering putting the commands from PUT, POST, and ...
David Brower's user avatar