# Update Client Data
source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/data-management/update-client-data/index.md

## Test case -- Success {#test-case--success}

This test case describes updating data of a specified client in the CMS.

Note: The field that you do not want to change must not be in the request. The field sent in the request with a null value explicitly will be cleared in the CMS. For this test case, use the following information in the request:

<br />

|               Field                | Available value |
|------------------------------------|-----------------|
| `clientPersonalData.title`         | MR              |
| `clientPersonalData.maritalStatus` | DD              |
|                                    | DM              |
|                                    | DS              |
|                                    | DX              |

**Sample request**

`PATCH /clients/40000 -H 'If-Match: "5c7d022061b0874200bfed735c6b9308"'`

```JSON
{
  "clientCustomData": [
    {
      "removeTag": false,
      "tagContainer": "ADD_INFO_01",
      "tagName": "TAG_01",
      "tagValue": "TAG_01_VALUE"
    }
  ],
  "additionalDate01": "2021-01-27T09:59:44Z",
  "additionalDate02": "2021-02-15T20:58:39Z",
  "clientBaseAddressData": {
    "addressLine1": "Mrs. Alice Smith Apartment",
    "addressLine2": "1c 213",
    "addressLine3": "Derrick Street",
    "addressLine4": "2nd floor",
    "city": "Boston",
    "country": "USA",
    "postalCode": "02130",
    "state": "MA"
  },
  "clientCompanyData": {
    "companyDepartment": "Department",
    "companyName": "Company",
    "companyTradeName": "Company Trade",
    "position": "Employee"
  },
  "clientContactData": {
    "email": "johndoe@example.com",
    "fax": "0048123456789",
    "faxHome": "0048123456789",
    "phoneNumberHome": "0048123456789",
    "phoneNumberMobile": "0048123456789",
    "phoneNumberWork": "0048123456789"
  },
  "clientIdentificationData": {
    "identificationDocumentDetails": "161235698529429",
    "identificationDocumentNumber": "161235698529328",
    "identificationDocumentType": "Passport",
    "socialNumber": "161235698529227",
    "taxPosition": "Tax position",
    "taxpayerIdentifier": "161235698529531"
  },
  "clientPersonalData": {
    "birthDate": "2021-06-25",
    "birthName": "Doe",
    "birthPlace": "Warsaw",
    "citizenship": "USA",
    "firstName": "John",
    "gender": "M",
    "language": "en",
    "lastName": "Doe",
    "maritalStatus": "DS",
    "middleName": "Carl",
    "secretPhrase": "secret",
    "shortName": "Madley",
    "suffix": "PhD",
    "title": "MR"
  },
  "clientExpiryDate": "2029-06-25",
  "embossedData": {
    "companyName": "COMPANY",
    "firstName": "JOHN",
    "lastName": "DOE",
    "title": "MR"
  }
}
```

**Sample response**

`204`  

`ETag: "7fedf39c3c2952a62821de4b480d1d6f"`

## Test case -- Fail -- Duplicated social number {#test-case--fail--duplicated-social-number}

This test case describes an attempt to update the data of a specified client with the `socialNumber`, which already exists in the CMS.

For this test case, use the following information in the request:

| Path parameter | Available value |
|----------------|-----------------|
| `client_id`    | 20002           |

|               Field                | Available value |
|------------------------------------|-----------------|
| `clientPersonalData.title`         | MR              |
| `clientPersonalData.maritalStatus` | DD              |
|                                    | DM              |
|                                    | DS              |
|                                    | DX              |

**Sample request**

`PATCH /clients/20002 -H 'If-Match: "5c7d022061b0874200bfed735c6b9308"'`

```JSON
{
  "clientCustomData": [
    {
      "removeTag": false,
      "tagContainer": "ADD_INFO_01",
      "tagName": "TAG_01",
      "tagValue": "TAG_01_VALUE"
    }
  ],
  "additionalDate01": "2021-01-27T09:59:44Z",
  "additionalDate02": "2021-02-15T20:58:39Z",
  "clientBaseAddressData": {
    "addressLine1": "Mrs. Alice Smith Apartment",
    "addressLine2": "1c 213",
    "addressLine3": "Derrick Street",
    "addressLine4": "2nd floor",
    "city": "Boston",
    "country": "USA",
    "postalCode": "02130",
    "state": "MA"
  },
  "clientCompanyData": {
    "companyDepartment": "Department",
    "companyName": "Company",
    "companyTradeName": "Company Trade",
    "position": "Employee"
  },
  "clientContactData": {
    "email": "johndoe@example.com",
    "fax": "0048123456789",
    "faxHome": "0048123456789",
    "phoneNumberHome": "0048123456789",
    "phoneNumberMobile": "0048123456789",
    "phoneNumberWork": "0048123456789"
  },
  "clientIdentificationData": {
    "identificationDocumentDetails": "161235698529429",
    "identificationDocumentNumber": "161235698529328",
    "identificationDocumentType": "Passport",
    "socialNumber": "161235698529227",
    "taxPosition": "Tax position",
    "taxpayerIdentifier": "161235698529531"
  },
  "clientPersonalData": {
    "birthDate": "2021-06-25",
    "birthName": "Doe",
    "birthPlace": "Warsaw",
    "citizenship": "USA",
    "firstName": "John",
    "gender": "M",
    "language": "en",
    "lastName": "Doe",
    "maritalStatus": "DS",
    "middleName": "Carl",
    "secretPhrase": "secret",
    "shortName": "Madley",
    "suffix": "PhD",
    "title": "MR"
  },
  "clientExpiryDate": "2029-06-25",
  "embossedData": {
    "companyName": "COMPANY",
    "firstName": "JOHN",
    "lastName": "DOE",
    "title": "MR"
  }
}
```

**Sample response**

`400`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "DUPLICATED_SOCIAL_NUMBER",
        "Description": "Duplicated social number.",
        "Recoverable": false
      }
    ]
  }
}
```

## Test case -- Fail -- Duplicated taxpayer identifier {#test-case--fail--duplicated-taxpayer-identifier}

This test case describes an attempt to update the data of a specified client with the `taxpayerIdentifier`, which already exists in the CMS.

For this test case, use the following information in the request:

| Path parameter | Available value |
|----------------|-----------------|
| `client_id`    | 20003           |

|               Field                | Available value |
|------------------------------------|-----------------|
| `clientPersonalData.title`         | MR              |
| `clientPersonalData.maritalStatus` | DD              |
|                                    | DM              |
|                                    | DS              |
|                                    | DX              |

**Sample request**

`PATCH /clients/20003 -H 'If-Match: "5c7d022061b0874200bfed735c6b9308"'`

```JSON
{
  "clientCustomData": [
    {
      "removeTag": false,
      "tagContainer": "ADD_INFO_01",
      "tagName": "TAG_01",
      "tagValue": "TAG_01_VALUE"
    }
  ],
  "additionalDate01": "2021-01-27T09:59:44Z",
  "additionalDate02": "2021-02-15T20:58:39Z",
  "clientBaseAddressData": {
    "addressLine1": "Mrs. Alice Smith Apartment",
    "addressLine2": "1c 213",
    "addressLine3": "Derrick Street",
    "addressLine4": "2nd floor",
    "city": "Boston",
    "country": "USA",
    "postalCode": "02130",
    "state": "MA"
  },
  "clientCompanyData": {
    "companyDepartment": "Department",
    "companyName": "Company",
    "companyTradeName": "Company Trade",
    "position": "Employee"
  },
  "clientContactData": {
    "email": "johndoe@example.com",
    "fax": "0048123456789",
    "faxHome": "0048123456789",
    "phoneNumberHome": "0048123456789",
    "phoneNumberMobile": "0048123456789",
    "phoneNumberWork": "0048123456789"
  },
  "clientIdentificationData": {
    "identificationDocumentDetails": "161235698529429",
    "identificationDocumentNumber": "161235698529328",
    "identificationDocumentType": "Passport",
    "socialNumber": "161235698529227",
    "taxPosition": "Tax position",
    "taxpayerIdentifier": "161235698529531"
  },
  "clientPersonalData": {
    "birthDate": "2021-06-25",
    "birthName": "Doe",
    "birthPlace": "Warsaw",
    "citizenship": "USA",
    "firstName": "John",
    "gender": "M",
    "language": "en",
    "lastName": "Doe",
    "maritalStatus": "DS",
    "middleName": "Carl",
    "secretPhrase": "secret",
    "shortName": "Madley",
    "suffix": "PhD",
    "title": "MR"
  },
  "clientExpiryDate": "2029-06-25",
  "embossedData": {
    "companyName": "COMPANY",
    "firstName": "JOHN",
    "lastName": "DOE",
    "title": "MR"
  }
}
```

**Sample response**

`400`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "DUPLICATED_TAXPAYER_IDENTIFIER",
        "Description": "Duplicated taxpayer identifier.",
        "Recoverable": false
      }
    ]
  }
}
```

