Discover JSON Patch, a great way to relay what you need to know from an API regarding only what has changed so you're not sending all the details over the pipes.
Join the DZone community and get the full member experience.Join For Free
Discover how you can get APIs and microservices to work at true enterprise scale.
The introduction for JSON Patch from RFC [RFC4627] describes it this way:
JSON Patch is an efficient way to only get the details from an API regarding only what has changed, instead of sending everything over the pipes each time. It makes sense that Streamdata.io has used it in conjunction with Server-Sent Events (SSE) to efficiently cache and stream data from existing web APIs. I have to admit, I never put this together with the PATCH method for API responses. Most of the APIs I’ve seen that use PATCH do not actually implement JSON PATCH, so this was a learning moment for me — something I’m always thankful for, constantly reminding me just how much I do not know in the space, even with my experience studying APIs.
Next, I’m going to invest more time understanding how to write code that navigates and applies JSON Patch in real-world situations. I’ve got my handful of Streamdata.io-enabled APIs streaming me data, but I don’t have the experience applying the changes to a UI or existing system integration as the data flows in. It all makes a lot more sense to me now and provides me with an efficient model for managing changes that occur across APIs. It is also yet ANOTHER reminder for me of how important it is that I study up on RFCs and be knowledgeable regarding existing patterns like this so that I’m not reinventing the wheel when it comes to my API design.
Published at DZone with permission of Kin Lane , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.