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 876089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:22:36+00:00 2026-05-15T11:22:36+00:00

I’d like some feedback on my current architecture. I have a Person resource that

  • 0

I’d like some feedback on my current architecture.

I have a “Person” resource that is available through GET and PUT requests to: /users/people/{key}. The resource produces and accepts “Person” objects in JSON format.

This is an example of the JSON that GET /users/people/{key} might return:

{
 "age":29,
 "firstName":"Chiquita",
 "phoneNumbers":[
   {"key":"49fnfnsa0sas","number":"555-555-5555","deleted":false}
   {"key":"838943bdfb-f","number":"777-777-7777","deleted":false}
  ]
}

As you can see, “Person” has some typical fields such as “firstName” and “age” as well as a trickier collection-type field: “phoneNumbers”.

I’m trying to design the resources so that when updating them, the client only needs to send back the fields that need to be updated. For example, to update only the person’s firstName:

PUT users/people/{key}

{
 "firstName":"New first name",
}

This way there is a lot less unnecessary information being transferred back and forth (degrees of magnitude less depending on the size of the the resource)

My question is, what should I do with the list properties such as “phoneNumbers.” Should I write some more complex code that examines the existing PhoneNumber keys in the old list and doesn’t touch them if they are not referenced, updates them if there is a matching key, and adds them if there is a PhoneNumber with a new key? Or should I write some simpler code that treats each “phoneNumbers” list property as just another field that is completely overwritten if it is included in the “PUT” request body? Is there a standard accepted approach to this where one strategy has been proven to be less problematic than another? or am I to use my discretion?

Thanks!

  • 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-15T11:22:37+00:00Added an answer on May 15, 2026 at 11:22 am

    I’m thinking it’d make the most sense to simply have the client upload all the info for the current person every time something is changed. However, this might not be adequate if:

    • A lot of data would have to be sent back and forth per change in typical scenarios.
    • Multiple people can edit the same person simultaneously.

    If your people objects are large, you might consider taking a diff/patch approach. Before sending the new version, compare it to the old version. If a singleton field (e.g. firstName) changed, simply list it in your JSON object:

    {
     "firstName":"New first name"
    }
    

    For the array of phone numbers, list the phone numbers to remove by key, and list the new phone numbers to add like you normally would. Something like this:

    {
     "+phoneNumbers":[
      {"key":"123456789abc","number":"555-123-4567"}
     ],
     "-phoneNumbers":[
      "49fnfnsa0sas"
     ]
    }
    

    You could also Google search “json diff” and see if any of the results you find are helpful.

    As I said before, unless you have a compelling reason to go to this depth of complexity, it’s probably best to just have the client re-upload the entire person object to update it.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.