Questions tagged [http]

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

Filter by
Sorted by
Tagged with
-2
votes
1answer
46 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 ...
-1
votes
1answer
93 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. ...
85
votes
8answers
131k views

RESTful API. Should I be returning the object that was created / updated?

I'm designing a RESTful web service using WebApi and was wondering what HTTP responses and response bodies to return when updating / creating objects. For example I can use the POST method to send ...
0
votes
2answers
166 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 ...
0
votes
1answer
122 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 ...
-1
votes
2answers
151 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 ...
1
vote
1answer
68 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 ...
3
votes
3answers
358 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 ...
0
votes
2answers
107 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 ...
1
vote
3answers
106 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", ...
1
vote
1answer
50 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 ...
1
vote
1answer
193 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 ...
-1
votes
3answers
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 ...
42
votes
4answers
18k views

REST - Tradeoffs between content negotiation via Accept header versus extensions

I'm working through designing a RESTful API. We know we want to return JSON and XML for any given resource. I had been thinking we would do something like this: GET /api/something?param1=value1 ...
6
votes
3answers
11k views

REST Webservices (post / put) : which type of parameter should I choose, and when?

On a POST (or PUT) webservice, I know can use three different type of parameters, I can send my parameters in the path of the URL /objects/{path_param}, after a question mark in the URL /objects?{...
0
votes
1answer
45 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 ...
0
votes
1answer
51 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 ...
81
votes
8answers
48k views

What HTTP status code to return if multiple actions finish with different statuses?

I am building an API where the user can ask the server to perform multiple actions in one HTTP request. The result is returned as a JSON array, with one entry per action. Each of these actions might ...
0
votes
0answers
40 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 ...
72
votes
4answers
19k views

Should I use HTTP status codes to describe application level events

Several servers I have dealt with will return HTTP 200 for requests that the client ought to consider a failure, with something like 'success : false' in the body. This does not seem like a proper ...
-4
votes
2answers
114 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 (...
71
votes
4answers
50k views

HTTP Status Code for "Still Processing"

I'm building a RESTful API that supports queuing long-running tasks for eventual handling. The typical workflow for this API would be: User fills in form Client posts data to API API returns 202 ...
0
votes
2answers
134 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", "...
1
vote
1answer
121 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 ...
2
votes
3answers
103 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 ...
2
votes
2answers
2k 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 ...
1
vote
2answers
285 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 ...
0
votes
1answer
215 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 ...
1
vote
1answer
110 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 ...
0
votes
0answers
21 views

Python flask app creating log files from pods

I have a flask app which reads logs from my kubernetes based on the environment product name and product type. I m creating the log files dynamically when a request arrives. If i choose a static ...
0
votes
0answers
59 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 (...
0
votes
2answers
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 ...
20
votes
2answers
17k views

Should I store my user claims in the JWT token?

I am using JWT tokens in HTTP headers to authenticate requests to a resource server. The resource server and auth server are two separate worker roles on Azure. I cannot makeup my mind as to whether ...
0
votes
0answers
73 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 ...
4
votes
6answers
8k views

Is it worth logging HTTP requests when they enter an API server?

I'm designing an API and have reached the topic of logging. I'm going to store my logs in Elasticsearch. I'm certainly going to do some logging at the time the HTTP response is sent back to the ...
0
votes
2answers
139 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 ...
0
votes
0answers
59 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 ...
-2
votes
1answer
33 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: ......
65
votes
3answers
23k views

Why PATCH method is not idempotent?

I was wondering about this. Suppose I have a user resource with id and name fields. If I want to update a field I could just do a PATCH request to the resource like this PATCH /users/42 {"name&...
2
votes
2answers
129 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, ...
0
votes
0answers
26 views

Should server return error page or render form again on 400 Bad Request

I have a basic web app (not api) with pages and forms. If a user sends a for e.g. register form with values that cannot be validated, I render the form page again with status 422 indicating where ...
2
votes
3answers
490 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 ...
37
votes
3answers
21k views

Recommended HTTP status code for "plan limit exceeded" response

I'm designing a REST API for a project where users are always on one of several "plans" - each plan defines some resource limits, such as the max number of users an account may have or the max number ...
0
votes
0answers
58 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 ...
4
votes
1answer
166 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 ...
0
votes
1answer
132 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 ...
-1
votes
2answers
225 views

How do job queues return results to UI?

I am working on an app that will run queries and return results to UI. However, these queries can take a long time to finish so I should not wait for the result. As far as I know, people use task ...
2
votes
1answer
413 views

How to structure your URIs?

I am making a web UI and an HTTP API for editing JSON documents in collaboration (role and versioning system). There are several types of JSON documents. Each type is described by a JSON schema, let ...
74
votes
4answers
74k views

What belongs in an HTTP request header vs the request body?

I'm working on a set of web services for a mobile client, and the requirements call for a unique device id to be included with all requests, to be stored in certain requests, and used to filter ...
-5
votes
1answer
783 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,...

1
2 3 4 5
8