When I accepted my very first role as a Data Scientist, I was extremely grateful, happy and overjoyed that I had broken into this amazing, competitive field! Eager to learn and very passionate, I…
HTTP is the widely used protocol for fetching resources over the web. It’s the building block for any data exchange that happens over the world wide web. Several applications that use HTTP protocol for accessing and storing resources needs a feature to partially modify the resources.
HTTP supports a PUT
method that does a complete replacement of the resource. It overrides the resource with a completely new body and cannot be re-purposed for partial modification of resources.
In this article, we will learn how to apply a JSON patch to the existing resource in conjunction with the HTTP PATCH
method in GoLang.
The JSON patch document can be used to partially update a resource. For instance, if you only need to modify one field of the resource, sending the entire new resource with just one field modified is not going to be a good option.
Considering we are going to make a remote call, PUT
ting a complete resource representation is going to utilize more bandwidth and might be a cumbersome job.
When used in combination with the HTTP PATCH method, it allows partial updates for HTTP APIs in a standards compliant way.
Sample JSON patch document.
Here are a few key differences between HTTP PUT
and PATCH
method.
I hopped on a long 20-hour journey consisting of 2 flight legs from Nigeria to Ireland in January 2017. It wasn’t the first time I was leaving home to study in a different country only this time…
The engagement ring is the most important piece of jewelry a bride-to-be will wear, so it’s no surprise that she spends months dreaming up the perfect ring. Every year, there’s a new set of…
This week I want to review a book titled the Marvel’s Black Panther: Art of the movie. The Art of Black Panther is an art book created by the Marvel Visual Production team and published by marvel…