Questions tagged [http]

HyperText Transfer Protocol - a textual system for representing web requests and replies.

Filter by
Sorted by
Tagged with
0 votes
1 answer
34 views

Handling resource not found

I have an endpoint GET home/{homeId}/laptops . Its response is : {"homeId":string,"laptops":string[]} If homeID does not exist I can return '404 Not found' OR an empty response ...
user avatar
-4 votes
2 answers
65 views

What are the possible *root causes* of a SocketTimeoutException?

I understand that a SocketTimeoutException (I'm in Java, but I guess it's the same in just about every major language) happens after a server or client doesn't respond after a period of time, let say ...
user avatar
-1 votes
0 answers
54 views

Is it ok for backend application to call it's own rest endpoint? Is it justificed if it can avoid code duplication for (e.g.) authorization?

I am working on spring boot application. Authorization of rest calls is something that is task common for all requests in the project - there might be a few groups but not that many. Therefore I think ...
user avatar
  • 107
0 votes
0 answers
37 views

Returning header Location on POST with no content

I am designing an API that some operations may take a while, for example, creating a backup (not the actual case). I am planning to have an endpoint to query the current job http GET /api/v1/jobs/{...
user avatar
  • 101
0 votes
4 answers
113 views

Design REST Polymorphic API

I have a client/server application that exposes data and commands through REST APIs. This API exposes a GET /recipes/:id endpoint that instructs the client on how to show a recipe. A recipe can be ...
user avatar
0 votes
1 answer
101 views

Is it a good idea to have conditional sync/async HTTP API

The api has one endpoint with some parameters. Based on these parameters I can predict how long the processing of the request would take. It can go from seconds(s) to tens of seconds. When expected ...
user avatar
  • 103
0 votes
3 answers
166 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 ...
user avatar
  • 139
2 votes
1 answer
221 views

Does it make sense to add an additional REST API to access a database?

I've recently joined a startup that has, in my opinion, a strange (and inefficient) way to access their database. Their implementation consists of multiple REST APIs that are exposed to multiple ...
user avatar
  • 33
0 votes
0 answers
45 views

HTTP and gRPC status codes equivalent to Nginx's 499 code (client closed request)?

Nginx introduces a 499 code, which is used when the client closes the connection before the server could respond. This is specific to Nginx. What would be the equivalent plain HTTP and gRPC status ...
user avatar
-2 votes
1 answer
99 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 ...
user avatar
-2 votes
1 answer
172 views

Securing http communication between backend services [closed]

What is a good way to secure http communication between two backend services which are not hosted on the same network? One way might be to have a shared secret in both services but I feel like that is ...
user avatar
  • 125
-1 votes
1 answer
101 views

Should micro services follow HTTP verbs precisely?

I'm concerned with the practices on my team regarding following REST and HTTP verbs precisely. For example, when we hit a get endpoint for a resource/resources that doesn't exist, we return a 404. ...
user avatar
  • 11
0 votes
2 answers
191 views

How can I do a GET for complex calculation when the amount of data required may be too large for a GET?

We have an internal library that does a calculation based on several datapoints. There is a fair bit of data required for the calculation, about 5kB in total. I'd like to make this an API endpoint for ...
user avatar
  • 139
0 votes
1 answer
135 views

How does resuming downloads work?

I have seen download managers manage to resume HTTP downloads from where they stopped. How are they able to resume downloads? Is it related to the Accept-Range Header? Or are there other mechanisms ...
user avatar
-1 votes
2 answers
154 views

What are the benefits of HTTP statuses compared to custom JSON based protocol?

I am currently developing a service and a client and I use HTTP statuses for communicating certain info. For example, I have a POST /vikings endpoint that starts a long running process to create a ...
user avatar
1 vote
2 answers
120 views

REST HTTP Response code for a resource that the user is not authorised to access

Suppose user A creates a private resource at, for example, /books/somebooktitle If user B attempts to access the resource at /books/somebooktitle what code should be returned? HTTP403: Permission ...
user avatar
  • 197
3 votes
3 answers
370 views

Is a good practice reuse HTTP codes to encode something else?

As we know HTTP codes are used in HTTP response. Usually with this code we can have an idea about what happened. For example if I make a get request and I obtain a 404 I can figure out that the ...
user avatar
  • 181
1 vote
3 answers
160 views

Is the "archetype controller" really complies with REST architectural style

I've read the Fielding's thesis that defines the REST architectural style and noticed that the defined style appears to significantly conflicts with the so called "archetype controller", ...
user avatar
1 vote
1 answer
52 views

How to implement UTM tracking correctly?

A GET should never change data on the server- use a POST request for that I heard this recommendation countless times over the internet and always try my best to conform. But how should I implement ...
user avatar
-1 votes
3 answers
144 views

What is the correct status code when serving different content than requested?

I'm working on a website that has different languages, being English the master language. Most of the site is fully translated but English content has a bigger team so it usually goes a bit ahead of ...
user avatar
  • 151
1 vote
1 answer
206 views

Advantages and disadvantages of including JS/CSS inside the HTML?

What are the advantages and disadvantages of including JS/CSS inside the HTML instead of separated files? Specifically concerned about performance issues, for example, if the CSS and JS are small and ...
user avatar
1 vote
1 answer
76 views

What is the correct architecture for communication between an HTTP server and a WS server on the same machine running in separate processes?

I have a Node.js HTTP REST API server and a Node.js WS server. I separated them into 2 entrypoints so that they can be more easily debugged and run separated from each other, but now I need the REST ...
user avatar
0 votes
1 answer
66 views

How to properly notify a client from the server side in Golang (broadcasting)?

I'm working on a project which focuses on simple HTTP-related actions (to get my feet wet really). I'm using the net/http package, which I thought was very convenient for almost all requirements ...
user avatar
  • 129
0 votes
1 answer
58 views

How to design a rest api for updating collection(ArrayList) of Resource in Spring boot?

I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList). class Client{ int id; String name; List<String> redirectUrls; } I have all CRUD ...
user avatar
0 votes
0 answers
56 views

Websockets or HTTP | B2B environment

Let's start off with the infrastructure architecture that we have, because that's the most important aspect of this conversation. Clients (browsers) which communicate with the product cluster (over ...
user avatar
  • 101
-4 votes
2 answers
122 views

Does the HTTP specification fully define the semantics of request methods?

I see two possible interpretations of the semantics of request methods defined in the HTTP specification RFC 7231: The intended effect of a request method is fully defined by the HTTP specification (...
user avatar
  • 570
0 votes
2 answers
146 views

A command as the intended effect of POST versus as the side effect of PUT

The intended effect (semantics) of the POST method is resource specific, e.g. executing a command with arguments: POST /command HTTP/1.1 {"parameter-1": "argument-1", "...
user avatar
  • 570
1 vote
1 answer
134 views

Asynchronous HTTP request pattern

Here is the pattern that I thought about for a resource accepting a single asynchronous HTTP request at a time (i.e. a request which has not yet been fulfilled when the response is sent): Create a ...
user avatar
  • 570
2 votes
3 answers
123 views

Can REST resources represent behaviour?

In the red book by V. Vernon it says about REST: In RESTful HTTP, the methods are the HTTP verbs - most importantly, GET, PUT, POST, DELETE - that can be applied to resources. Even though it might ...
user avatar
  • 396
1 vote
2 answers
354 views

Roy Fielding’s REST alternative to HTTP cookies

I struggle to understand Roy Fielding’s REST alternative to HTTP cookies, § 6.3.4.2 ‘Cookies’ and § 6.5.4.1 ‘Application State in a Network-Based System’ of his doctoral dissertation Architectural ...
user avatar
  • 570
1 vote
2 answers
524 views

Long polling and message brokers

I was reading this article, and the author uses HTTP long polling to design a chat application. I was wondering how does this compare with a dedicated Message Broker services like Apache Kafka, or ...
user avatar
  • 169
1 vote
1 answer
178 views

Best practice for deleting resource from web page

So I have been down the rabbit hole of finding that HTML forms don't support DELETE requests, and then looking into mimicking the the behaviour with a Javascript fetch request (but it is not ...
user avatar
  • 119
0 votes
0 answers
84 views

HTTP polling vs WebSocket for very small payloads that don't change often

In our team we are currently discussing which technology makes more sense for an upcoming feature - HTTP polling vs WebSocket. To give some context: We are developing a TV streaming application (...
user avatar
5 votes
2 answers
5k views

How do you set cookies on frontend from the backend?

I'm a little confused about how to handle cookies between frontend and backend. I have a frontend react application a backend node express application. The frontend is hosted on Netlify and the ...
user avatar
0 votes
2 answers
42 views

Should an Express error handler be used to send HTTP 4xx responses?

In other words, should the raising of an HTTP 4xx code be considered an error, and should the job of sending an HTTP 4xx code to a client be delegated to an error handler? Or is it simpler to just ...
user avatar
  • 109
0 votes
0 answers
90 views

In a microservices architecture, should each microservice handle its HTTP headers or should a proxy handle them?

In a case where having microservices deployed as containers without any orchestration tool, they need to define some HTTP response headers. I understand a way to achieve it by having each microservice ...
user avatar
  • 119
0 votes
2 answers
214 views

How to implement authorization in a microservices architecture?

I'm looking for a way to avoid centralized management of authorization rules. I'd like every microservice to be responsible for the authorization logic of its actions, but I'm having some trouble ...
user avatar
0 votes
0 answers
103 views

HTTPS headless browser to HTTP localhost Flask

I have two Docker containers: Headless browser grabbing images by running JavaScript Flask server analysing these images (and sending results to another server) I'm using a bridge network to ...
user avatar
  • 9
-2 votes
1 answer
35 views

What is the correct terminology for the components for a CURI?

Given a curi like [auth:password_reset_confirm], what do you call the part before the colon and what do you call the part after the colon? I have a json payload with come CURIs that look like this: ......
user avatar
  • 197
2 votes
2 answers
133 views

Is there a reliable way to get get the fingerprint of a file hosted online, without fully downloading it?

Background Tertiary to this question, I have been building my own imageboard that prevents [for example] duplicate images from being downloaded again and again on behalf of the client. How I do this, ...
user avatar
  • 3,319
2 votes
3 answers
801 views

Email Confirmation links must be GET, but not safe

When a user signs up to a web app, they often get a confirmation email. This email will contain a link. Once the user clicks the link, the app confirms the user's account as correctly associated with ...
user avatar
0 votes
0 answers
102 views

How to change data after success URLs sent to partner API's if they can only be GET requests?

A lot of times there's a parameter in a partner API endpoint like success_url where you provide the partner API with an endpoint on your internal API to redirect the client. For example, on Stripe you ...
user avatar
4 votes
1 answer
168 views

Accessing Animal not belonging to User: 400, 401, 403, 404, other?

Consider animals being some REST resources. User has animals assigned to him. The endpoint /api/animals/{animalId}/feed is used to feed a given animal by the authenticated user. User should not be ...
user avatar
  • 241
0 votes
1 answer
148 views

Is this the right way to call async and await

Hi I am new to async/await in C# . I have created a controller which is accessing result from HttpClient injected through HttpFactory. Here is my working example class MyController { private ...
user avatar
  • 109
-5 votes
1 answer
1k 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,...
user avatar
-5 votes
1 answer
724 views

What are services and interfaces of a layer in a computer network model? [closed]

In Tanenbaum's Computer Networks book Three concepts are central to the OSI model: Services. Interfaces. Protocols. Probably the biggest contribution of the OSI model is that it makes the ...
user avatar
  • 5,261
0 votes
1 answer
131 views

Is it bad practice to mutate your HttpClient objects?

Im in the process of creating a base class for typed HttpClient services (yes, I'm utilizing IHttpClientFactory). I wrote the process in such a way that for each CRUD method invoked from the service, ...
user avatar
  • 1,349
0 votes
1 answer
143 views

Should an http API client hide the http response object?

I'm using a client library for an HTTP API. The client exposes objects and methods matching the domain, e.g. Api::Document.download, but the return value is just the http response from the API. As the ...
user avatar
1 vote
4 answers
119 views

Replace Rest verbs with custom object to drive resource operations

One of my clients has a Restful API on which I'm supposed to work on that only exposes two verbs: POST and GET. The POST endpoint is used in lieu of the standard Rest verbs: PUT, DELETE, PATCH. The ...
user avatar
2 votes
1 answer
320 views

What do you call the combination of endpoint and HTTP method in a REST API?

Let's use the Twitter API as an example. My understanding is that we refer to /statuses/update as an endpoint and we refer to POST as a HTTP method. So what would term do you use to refer to the pair ...
user avatar
  • 139

1
2 3 4 5
8