Skip to content

Instantly share code, notes, and snippets.

@steven-ferguson
Last active April 17, 2020 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steven-ferguson/6ea735e7593deb9ae27f33d1aac14c3a to your computer and use it in GitHub Desktop.
Save steven-ferguson/6ea735e7593deb9ae27f33d1aac14c3a to your computer and use it in GitHub Desktop.
Phone number and email Patch

Given the following state:

  • User A (id: 'a') with the following documents
documents: [{
  "id": "a_123"
  "email": "foo@gmail.com",
  "phone_number": "901.111.1111",
  ...
}]
  • User B (id: 'b') with the following documents
documents: [{
  "id": "b_456",
  "email": "baz@yahoo.com",
  "phone_number": "901.222.2222",
  ...
}]

PATCH /v3.1/users/a is called with the following payload:

{
  "documents": [{
    "id": "a_123",
    "email" "baz@yahoo.com",
    "phone_number": "901.222.2222"
  }]
}

User A now has the following state:

Document "a_123"'s email and phone_number are updated

"documents": [{
  "id": "a_123",
  "email" "baz@yahoo.com",
  "phone_number": "901.222.2222",
  ...
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment