Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • "sparse": true => collection elements not specified in the update requests are not modified
  • "sparse": false => collection elements not specified in the update requests are deleted

Example

...

- Update an employees work_locations

Given the following employee record exists

Code Block
languagejs
titleemployee
{
  "employees": {
    "id": "4fc4d621-8037-0133-3e14-025dd6a1bb31",
    "first_name": "John",
    "last_name": "Doe",
    "birth_date": "1976-03-17",
    "work_locations": [
      {
        "id": "568f021e9537296f45004856",
        "role": "developer",
        "work_location_id": "c48ca3b1-97cb-0133-6118-060bcee6eb9d"
      },
      {
        "id": "568f021e9537296f45004858",
        "role": "developer",
        "work_location_id": "e9c39df1-97cb-0133-611c-060bcee6eb9d"
      }
    ],
    "channel_id": "org-abcd",
    "resource_type": "employees"
  }
}

Sparse update

Sending the following PUT request with the option "sparse": true

...

Code Block
{
  "employees": {
    "id": "4fc4d621-8037-0133-3e14-025dd6a1bb31",
    "first_name": "John",
    "last_name": "Doe",
    "birth_date": "1976-03-17",
    "work_locations": [
      {
        "id": "568f021e9537296f45004856",
        "role": "software developer",
        "work_location_id": "c48ca3b1-97cb-0133-6118-060bcee6eb9d"
      },
      {
        "id": "568f021e9537296f45004858",
        "role": "developer",
        "work_location_id": "e9c39df1-97cb-0133-611c-060bcee6eb9d"
      }
    ],
    "channel_id": "org-abcd",
    "resource_type": "employees"
  }
}

Non-sparse update

Sending the following PUT request with the option "sparse": false

...