2

Hello I add one custom attribute of profile_picture to save the profile picture of customer but when i try to call the http://domain.com/ecommerce_app/rest/V1/customers API with following JSON Request:

{
 "customer": {
     "email": "[email protected]",
     "firstname": "Abc",
     "lastname": "Xyz" ,
     "custom_attributes": [
      {
        "attribute_code": "profile_picture",
        "value": {
            "base64EncodedData": "iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==",
            "type": "image/png",
            "name": "new_image.png"
        }
      }
    ]

 },

 "password": "Abc@123456"
}

I got the following error:

{"message":"Error occurred during \"custom_attributes\" processing. Attribute \"profile_picture\" has invalid value. The \"array\" value's type is invalid. The \"string\" type was expected. Verify and try again."}

Please help me how to fix this

1 Answer 1

0

Looking at the error message posted, it looks like the customer attribute you created "profile_picture" accepts only "string" value, but you are passing an array of values. Try passing the value field with string as shown below.

{
 "customer": {
   "email": "[email protected]",
   "firstname": "Abc",
   "lastname": "Xyz" ,
   "custom_attributes": [
    {
      "attribute_code": "profile_picture",
      "value": "new_image.png"
    }
   ]
},
"password": "Abc@123456"
}
1
  • But in magento2.3 Customer REST API we need to upload image base64 code instead of image file Commented Jul 2, 2020 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.