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
1
vote
1 answer

Invalid HTTP method: PATCH in Java 8

I am trying to post payload to ClientApp RESTAPI via PATCH as HTTP_METHOD in Java. There are lot of similar ERROR found in google and got suggestion to use X-HTTP-Method-Override header. I followed this blog code base to achieve the same. Java…
Justin
  • 855
  • 2
  • 11
  • 30
1
vote
0 answers

PATCH Request NOT Updating All Requested Values of JSON Data in Javascript

I am attempting to change the values of some existing JSON data with a PATCH request, but when sending the request, only some of the requested values are updated, not all. PATCH Request: function updateRequest(){ let updateOptionValuesUrl = …
1
vote
1 answer

JSONPatch escape slash '/' from JSONPatch+JSON

I've below JSON and I wanted to update few fields from it { "process": "my-process", "pod": "some-pod", "org": "some-org", "config": { "version": "436_601_83.0.0", "path": "companyName/ccg", …
Swapnil Kotwal
  • 5,418
  • 6
  • 48
  • 92
1
vote
0 answers

How to properly write a Django view for a Patch request

So I am making a view in Django, and I'm trying to use POST for creation, GET for fetching, I wanted to use PATCH for handling updations, but I am struggling to understand how to process an incoming PATCH request's data. I am sending a PATCH request…
1
vote
1 answer

Can a PATCH request be used to create new fields for an already existing resource?

I am insecure whether to use an combination of POST & PATCH or if it is better to only offer PUT requests for my use-case. If I am creating the following resource: POST /customer firstname: John lastname: Smith email: j.smith@web.com (response ->…
1
vote
1 answer

Json Patch in Asp.net core api with cosmos db

Is it possible to use dotnet core api's HTTPPATCH / JSONPATCH with azure cosmos db? Is there any sample?
1
vote
1 answer

Is HTTP PATCH restricted to modifying only one field at a time?

Does HTTP PATCH method restrict updates to only one field at a time? Can I modify more than one field in a PATCH request? Can PATCH be used for modifying all the fields?
user1354825
  • 1,108
  • 4
  • 21
  • 54
1
vote
2 answers

How to validate http PATCH data with a JSON schema having required fields

I'm trying to validate a classic JSON schema (with Ajv and json-server) with required fields, but for a HTTP PATCH request. It's okay for a POST because the data arrive in full and nothing should be ommited. However, the required fields of the…
jmpp
  • 346
  • 1
  • 4
  • 22
1
vote
1 answer

How do I send data along with APITestCase client.patch() in DjangoRestFramework?

My TestCase: class MyApiTests(APITestCase): def test_retrieve(self): resp = self.client.patch('/my/endpoint/', data={ 'name': 'new name', 'age': 25, 'some_array': [{ …
Troy
  • 21,172
  • 20
  • 74
  • 103
1
vote
1 answer

Updating one or more values with MarkLogic patch

I'm trying to use MarkLogic's patch functionality (in version 9.0-9.1) to be able to edit one or more elements of a document. In the application, a user would have a screen that is populated with the original values and be able to edit one or more…
MGlos
  • 45
  • 4
1
vote
1 answer

Spring Data Rest PATCH requests do not fill transient properties not backed by a field

I want to implement a PATCH-Requese on an entity 'User' for changing the password with an additional transient property 'oldpassword' to compare it in the EventHandler. The POST- and the PUT-request fill the property. The PATCH-request doesn't:…
Bla Blubb
  • 23
  • 4
1
vote
1 answer

How to pass data from Vue to Laravel for patch request?

i'm trying to send a patch request from my Vuetify data-table to Laravel & then to a mySQL DB. Here's various code pieces from my controller.php, my api.php & the actual Vuetify file: api.php: Route::patch('machines/{id}', [ 'as' =>…
Pok3r Princ3
  • 147
  • 2
  • 13
1
vote
1 answer

Different uri for PATCH vs PUT when changing uri slug

In a proper REST API implementation, imagine I'm writing an API to let the user modify a uri slug, such as changing /acme/first to be /acme/second. Depending if I'm submitting a partial record (patch) or the whole record (put) that currently…
Devin Burke
  • 13,642
  • 12
  • 55
  • 82
1
vote
2 answers

HTTP code to return for unsupported PATCH

I am implementing a PATCH method on a dropwizard REST resource. Currently only a subset of the properties of the resource an be patched. And currently only the replace operation can be fulfilled. Which HTTP code should I return if I see a PATCH…
Manolo
  • 1,597
  • 4
  • 21
  • 35
1
vote
1 answer

How to invoke the API action of type [HttpPatch] from HttpClient class in asp.net core mvc

My API has an [HttpPatch] action which i need to invoke. [HttpPatch("{id}")] public StatusCodeResult Patch(int id, [FromBody]JsonPatchDocument patch) { Reservation res = Get(id); if (res != null) { …
Joe Clinton
  • 145
  • 1
  • 12