Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:16:08+00:00 2026-05-26T14:16:08+00:00

I’m working on a new REST-ful API who’s primary/only consumer will be a smart/non-web-browser

  • 0

I’m working on a new REST-ful API who’s primary/only consumer will be a smart/non-web-browser client. I have a collection resource that is maintained/updated by background processes, not by the client itself. The only content type needed for the first iteration is JSON. The URIs are something like:

  • /items/ – Resource representing the collection of items.
  • /items/123 – Resource representing the individual item with ID 123.

Although the client will not be creating new items, or updating the collection to add/remove items, it will be updating some of the values in the individual items. My plan is to use HTTP PATCH to update item resources, using my own JSON patch format.

There will be many concurrent clients reading the items, and concurrent updates to different items, with occasional concurrent updates to the same item, and although a certain degree of “eventual consistency” is allowed, I would like to design this in as “cache friendly” a way as possible. Reading the RFC for PATCH, I see that on a successful response to PATCH, the cache of the Request-URI should be updated with the response, if there is one. The question comes down to:

Do I:

A) include the full representation of the individual items in the /items/ collection resource JSON representation, and send the PATCH to the /items/ URI and include the item to update in the patch format?

PROS:

  • This allows the client to not have to do N number of requests just to display the listing of resources
  • lets any cache of items be invalidated when a client updates an item.

CONS:

  • This isn’t as “clean” to me, as I’m not really updating the collection, but an individual item.
  • This invalidates the cache of the whole collection, instead of the cache of the single item that changed.

OR

B) In the JSON representaiton of the resource collection, only include links to the items included, and have the client request the individual items after discovering which ones are in the collection. HTTP PATCH would be sent to the individual item URI (e.g. /items/123)

PROS:

  • Caching of the collection and item resources independently. PATCH of an individual item can properly invalidate the cache of just that item.
  • API is clearer, since you issue an HTTP PATCH on the specific item you want to update.

CONS:

  • Does not allow for batch updates to items. This is not currently a requirement at all, and I don’t foresee it in the future, but only hindsight is 20-20.
  • Requires the client to issue N+1 requests to display the full list of items.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:16:08+00:00Added an answer on May 26, 2026 at 2:16 pm

    I would go for B. But are you clients usually asking for all the collection (I mean do they need the collection) ? if not A option would be generating way too much traffic. And invalidation of cache occurs for all of the items (as they are in the collection).

    If your clients mostly get the whole collection then A with a query param for the specific item is also an option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I'm making a simple page using Google Maps API 3. My first. One marker
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.