Questions tagged [http-request]
The http-request tag has no usage guidance.
111
questions
-1
votes
3
answers
369
views
HTTP REST API: Is it wrong to put search parameters in a custom header?
The contents of search string are typically sent as part of the URI query:
https://domain.name/resource?search=something+i+am+searching+for
Those same contents can be sent as the value of a custom ...
0
votes
1
answer
165
views
Exchanging data between two Microservices
I am facing this problem and would like to review my approach to it here.
A Client sends an HTTP request to Service A and is expecting an answer.
Service A is connected to DB A. When it receives a ...
2
votes
2
answers
443
views
Improve performance for HTTP Request with huge body
I'm struggling to understand how to improve the performance for an HTTP Request that comes with a huge body.
Now, let me explain better what I mean with performance!
Imagine I have a DB with the table ...
2
votes
2
answers
1k
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
102
views
Should I keep the structure of the API request body same in all cases?
I have Items and Im creating an API which validates different aspects of an Item. eg: whether it has a valid height, width or depth.
My request body looks like
{
height_check: true,
width_check: ...
-2
votes
3
answers
1k
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 ...
0
votes
1
answer
1k
views
Can I use POST request to read and transform data?
I'm developing an API that given a few parameters, reads the given data, transforms it and returns it as JSON.
Eg. (some logic included)
Request:
POST /myApi/exportAsText
Content-Type: application/...
0
votes
1
answer
589
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
vote
1
answer
126
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 ...
0
votes
1
answer
150
views
When does it become appropriate to make http calls?
Background: different developers are building an e-commerce system using Spring. Some are working on the user facing arm, others are working on the CMS, while the other group are working on the vendor ...
3
votes
2
answers
452
views
parameter longer than the length limit of GET into a RESTful interface
In a Restful API, it is better to use GET to list a collection. However, in our scenario, we allow people query with a list of parameters (say CodeList) and then return details.
As we allow upto 500 ...
0
votes
1
answer
197
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 ...
-4
votes
2
answers
126
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 (...
0
votes
2
answers
200
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", "...
6
votes
3
answers
1k
views
GET vs POST when exposing machine learning model predictions using a REST API
So the recommendations for using GET vs POST in a REST API that I've read on stack overflow are geared almost exclusively toward CRUD operations involving a database.
However if you are simply writing ...
0
votes
2
answers
537
views
Does PUT need to be idempotent?
It has been said that "PUT is idempotent":
The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side ...
2
votes
2
answers
200
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, ...
4
votes
3
answers
2k
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 ...
0
votes
0
answers
283
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 ...
0
votes
4
answers
519
views
What problems could be caused by inserting into a database on an HTTP GET?
I have code that checks if the scanned qr code exist in the database and if it exist it will insert data into another table but I did it in the HTTP GET request, is this alright to do it this way or ...
8
votes
5
answers
624
views
How to map "mv" operation to HTTP verbs?
In designing a RESTful api the problem arises as to how best to allow resources to be moved between collections.
Renaming a resource could be done by using PATCH but this is not the same thing as ...
1
vote
3
answers
1k
views
How to keep front-end models in sync with REST API/DB without any UI delay?
Here's my problem. I want to make fast, subsequent requests to a REST API endpoint (/todos/:id/position) that have side effects on other resources.
As an example of 5 fast subsequent requests:
PATCH /...
0
votes
1
answer
44
views
How would you have a fallback for html insert when the html has changed?
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 ...
2
votes
1
answer
855
views
REST: upload binary data with PUT method
I have an restful app that uses PUT to replace existing data. For example, there's a user management url https://myserver/users, and to replace user data, for example, to change the name and the ...
1
vote
1
answer
114
views
What constitutes "identical" for the purposes of HTTP idempotence?
From RFC 7231 "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content" Section 4.2.2 "Idempotent Methods":
A request method is considered "idempotent" if the ...
2
votes
1
answer
166
views
How do I send data to HTML page only when a POST endpoint is hit?
I've looked through similar questions and tried to Google what I'm trying to do, but I haven't found anything concrete.
What I'm trying to do: where I work, we use an HMI/SCADA system that displays ...
3
votes
1
answer
6k
views
Typescript and Angular 6 - Mapping Service Results to Data Transfer Objects
I think I am just look for a bit of code review advice. It might possibly be a methodology question?
Essentially when I am pulling data (usually from a REST request), I generate a service, then ...
1
vote
1
answer
1k
views
Where to include a pfx certificate in a http request?
I would like to understand what happens in a request which includes a .pfx certificate to authenticate to client to the server. I know how to implement this in python or use it in postman, but I don't ...
64
votes
10
answers
13k
views
How do I mitigate a scenario where a user goes to pay, but the price is changed mid-request?
This is kind of similar to the Two Generals' Problem, but not quite. I think there is a name for it, but I just can't remember it right now.
I am working on my website's payment flow.
Scenario
...
-1
votes
1
answer
49
views
Would it work to use http patch more general and even "unpatch"?
Is it a good idea to make http patch more general and also create a new property or even a new persistent entity if it does not exist. The patch could be general and send http body for different ...
2
votes
1
answer
245
views
Application for forwarding data from websocket to HTTP method
I have a Raspberry Pi with a ConBee 2 (ZigBee) interface connected. The ConBee provides a websocket I can connect to to get push notifications on sensor changes. And I want to forward those ...
2
votes
1
answer
970
views
best way to create @PUT upon multiple entities and compatible with RFC
I am trying to build the best PUT possible that allows modifying multiple entities upon single requests using java jersey.
The idea is to send a request with multiple entity ids as @PathParam values ...
2
votes
1
answer
106
views
Does it make sense to qualify an error as an HTTP error without an HTTP client-server communication
I am writing a C# client SDK to a REST Api. This SDK sends JSON-serialized models to the API, and implements a first level of verification of the parameters. If the verification fails, it throws an ...
1
vote
1
answer
302
views
Which HTTP code has higher priority: 403 or 415?
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 ...
3
votes
1
answer
462
views
How do I create an HTTP PUT request that modifies the resource in many ways
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 ...
1
vote
1
answer
730
views
Client-side XHR request, which IP does the endpoint read?
Assume a Javascript plugin, for a developer, that's included on their website.
<script src="https://external.com/plugin.js"></script>
The plugin makes a XHR request to a 3rd party ...
-2
votes
2
answers
89
views
REST API acceptable design flexibility
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 ...
0
votes
0
answers
117
views
HTTP Method and REST URL for Returning Data that May Be Saved
My application has a grid with a list of Car objects from a third party system
[{id: 1, make: "Ford", model: "Focus", ...},...]
The user can select a Car and use its data (after some transformation)...
1
vote
2
answers
352
views
Is it okay to use a 'HttpPut' or 'HttpPatch' verb and allow the API method not to check for a Patch doc or resource?
I'm not sure what the correct procedure is, when you have a question based off an answer you read but it is a seperate question that arose because of the answer provided.
the answer in question Which ...
1
vote
1
answer
1k
views
Which is better solution - having separate model class against each REST API or keep adding info in single object?
I have a class Person.
Person {
String firstName;
String lastName;
String Date dob;
String email;
String mobileNumber;
String address;
}
To add a person, I have following REST APIs:
POST /...
1
vote
0
answers
463
views
How to simplify design and remove duplication in java layered architecture?
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,...
15
votes
6
answers
4k
views
What reasons are there AGAINST using only POST HTTP verb in an API?
I am researching before starting to work on an API for a web-service I am building. The goal is to be very quick and easy to adapt and use for other developers but fairly hidden for clients using a ...
1
vote
1
answer
177
views
Theoretical: How Do Servers Handle Requests With No Spare Memory?
I'm trying to understand how servers handle many requests when they start to run out of RAM.
Let's say you have a server with 1GB of idle RAM. Let's pretend it was bombarded with 1024 requests in 1 ...
2
votes
2
answers
8k
views
Better to block on async with HttpClient than use synchronous API like WebRequest?
I have been a staunch advocate of never blocking on async code. I felt it was always better to use a synchronous API than to run the less efficient state machine generated by the compiler even if ...
1
vote
2
answers
328
views
How to limit the amount of requests by minute to a external system on a micro services environment?
I'm having some problems to think on a solution to control the amount of requests by minute to a external system on a micro services environment on Kubernetes.
The scenario
This external system is ...
16
votes
1
answer
72k
views
Use Case of HTTP GET Request with a Body
I am maintaining a old .aspx page in which all the data required by the page to show the content is passed in the URL of the GET request as a part of query string. The result of this is that, as we ...
0
votes
3
answers
205
views
How far do you go in server-side validation of POST/GET requests?
Our application had a few vulnerabilities detected by AppScan and we had to add server-side validation to catch SQL injection attempts.
But my question is, how far do you go in server-side ...
-4
votes
1
answer
3k
views
What happens if multiple users send http requests to the server concurrently? [closed]
So basically, it is a web server that is hosting a php project. The project accepts some inputs from the users and send them to the server via ajax for validation each time the check button is clicked....
2
votes
1
answer
468
views
How to HTTP request to a website that uses robot verification
I need to make some get/post requests to a website that I have credential to log in. I plan to do this with Ruby and Net::Http. As I'm new to this kind of experience, I'm struggling with the fact that ...
11
votes
2
answers
10k
views
What is a proper response status code to POST when parent resource is not found?
I've the following endpoint:
a/{id}/b
and want to create a b with sending POST request to it. If a with given {id} is not found should I response with 404 NOT_FOUND or maybe with 409 CONFLICT?
It ...