Skip to content

Update Customer data with REST API #21237

Closed
@judaschwartz

Description

@judaschwartz

Preconditions (*)

  1. 2.3.0 (have not tested previous versions)

Steps to reproduce (*)

  1. When using the API to update a customer

    curl -X PUT "https://example.com/index.php/rest/all/V1/customers/8" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d "{ "customer": { "middlename": "string" }}"

Expected result (*)

  1. The customer should be updated for those fields just as when using the API to update a product a PUT request like this

    curl -X PUT "https://example.com/index.php/rest/all/V1/products/24-MB01" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d "{ "product": { "visibility": 3 }}"

updates the visibility for the product with that SKU (as one would expect) however when i try to make a similar update to a customer with a PUT request i get:

Actual result (*)

  1. I get a 400 error with "message": "The customer email is missing. Enter and try again." the API to update only works if i add all of the required data like this:

    curl -X PUT "https://example.com/index.php/rest/all/V1/customers/8" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d "{ "customer": { "id": "8", "firstname": "Jon", "lastname": "Smith", "email": "[email protected]", "middlename": "jac", "store_id": 1, "website_id": 1 }}"

if I leave any of these values out i get an error with the exception of id which if left out creates a new record or throws an error if the email already exists (despite the id being specified at the end of the URL) also when id is passed in with the data that IDs record is updated even if it is not the id at the end of the URL

This does not seem to be the way the API should operate any help or explanation of whats going on would be appreciated.

Metadata

Metadata

Labels

Component: CustomerFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions