Questions tagged [http-patch]

PATCH is one of the http-request methods

While PUT uploads the entire resource of an already existing entity, PATCH is used to send only the changed attributes of a resource to the server.

The PATCH method was specified in RFC 5789, where its use is described as follows:

Several applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification. The existing HTTP PUT method only allows a complete replacement of a document. This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource.

It specifies the following differences to the PUT method:

The difference between the PUT and PATCH requests is reflected in the way the server processes the enclosed entity to modify the resource identified by the Request-URI. In a PUT request, the enclosed entity is considered to be a modified version of the resource stored on the origin server, and the client is requesting that the stored version be replaced. With PATCH, however, the enclosed entity contains a set of instructions describing how a resource currently residing on the origin server should be modified to produce a new version.

See this answer for more information.

156 questions
0
votes
0 answers

Http Patch Operation Not Updating Database In EF Core .NET Core

I am trying to apply patch operation in Data Layer Repository but due to have no Model State available in Data Layer i am unable to update it. I have debug the overall logic i come to the conclusion that patch.ApplyTo() operation update the Model…
0
votes
1 answer

Shall is use PUT for updating all 100 Fields in Employee table and Patch for updating 99 Fields?

In an interview, I was asked: When to use Patch and when to use Put? I replied: when need to update all fields then PUT else use Patch. And the counter question was: Shall is use PUT for updating all 100 Fields in Employee table and Patch for…
fatherazrael
  • 5,511
  • 16
  • 71
  • 155
0
votes
1 answer

using HttpMethod Patch in .NET Framework

I need to use Patch method in my Web API. I tried like this: using (var request = new HttpRequestMessage(new HttpMethod("Patch"), new Uri(url))) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes("log:pass"); string val =…
0
votes
1 answer

HTTP PATCH no 'Access-Control-Allow-Origin' header in ASP.NET Core 6

I have reviewed the information on Enable Cross-Origin Requests .NET 6 to no avail. This only affects the HttpPatch. When I run it in Swagger, no problems. When I try to test through 3rd party tool or CORS Test tool, I get errors. The policy used…
danijeljw-RPC
  • 345
  • 2
  • 13
0
votes
1 answer

AttributeError: 'NoneType' object has no attribute '_meta' while updating data using nested serializers via PATCH call in Django Rest Framework

I want to update the Model data using nested serializers via PATCH call in DRF. I have custom User Model, Country, City, Detail Model. I have MainUserSerializer, CountrySerializer, CitySerializer and UserSerializer, and I have UserAPI view. Below is…
0
votes
0 answers

c# post request with headers?

I want to post a request to a url, using content-type and authorization. I am getting error 400 "Bad Request". I have tested with the same data and headers in python and it worked. So I think there is something wrong with how I set up my headers.…
EggEgg
  • 1
  • 1
0
votes
1 answer

How can I make Patch request in Angular 12?

How can I send JSON data with patch request and which method to connect to API? private baseUrlRemoveNotifications: string = "api/v1.0/UploadDownload/removeNotifications"; public removeNotificationForUser(onlineUserModel: OnlineUserModel) { …
user18161673
0
votes
0 answers

Why my data isn't updating using Http Patch in flutter with Realtime Database

I am trying to update a list of data in my real-time database using "Patch" in Flutter. I tried using the following codes but don't where I made mistake or what's wrong with my codes. Map UpdatetitleMap = { 'oldname': "Marvel", …
0
votes
0 answers

Failed to call PATCH in Postman

here's my code for setting up PATCH request in node.js app.patch('/api/v1/tours/:id', (req, res) => { const id = req.params.id * 1; const tour = tours.find(tour => tour.id === id); if (!tour) { return res.status(404).json({ …
0
votes
1 answer

PATCH API don't work on Google Cloud Run instance

I have cloud run services hosting GO OSB application implementing gRpc but exposing the http REST api's via grpc-gateway which uses cloud sql (mysql) as a DB. All the CRUD API's are responding fine except the PATCH one. It's throwing the below…
ak89224
  • 151
  • 1
  • 5
0
votes
1 answer

How to delete items from a subset with REST API

I'm wondering what are the best ways to delete items from a subset in a restful way. I got users and series, each user has his own list of series (watching, completed, etc). For example, if we want to get a list from a user we can do it with: GET…
0
votes
0 answers

Sending http patch request with list of maps in flutter

I have a class StyleItem, which looks like following: class StyleItem { String id; double dx; double dy; double scale; double rotation; StyleItem({this.id, this.dx, this.dy, this.scale, this.rotation}); Map toJson() { return { …
0
votes
2 answers

Response body when PATCHing a collection

In my REST API I have a very large collection; it contains millions of items. The path for this collection is /mycollection Because this collection is so large it is not good practice to GET the whole collection so the API supports paging. Paging…
HairOfTheDog
  • 2,489
  • 2
  • 29
  • 35
0
votes
1 answer

Asp.Net Core Web API Patch Id Is Always NULL

I have a asp.net core web api with an endpoint using PATCH. Need to update a single field of a record. I have the endpoint setup to accept the id of the record along a Json Patch Document body. Here is how my endpoint is currently setup. I just have…
Tom
  • 57
  • 1
  • 8
0
votes
1 answer

(.net core 3.1 & Angular) Json Patch: The path segment is invalid for an array index

I have a json file with the following content: { "Id": 0, "Name": "todoList1", "ListItems": [ { "Id": 1, "Description": "listItem1.1", "Done": false }, { "Id": 2, …
xeraphim
  • 4,375
  • 9
  • 54
  • 102