Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Getting exception while creating customer using api

Getting exception while creating customer using api

hadiurrehman01
Visitor
1 0 0

 

Hi everyone, I am creating a customer using rest API(/admin/api/2022-04/customers.json) with the following payload.

{
    "customer": {
        "first_name": "john",
        "last_name": "doe",
        "email": "johndoe@example.com",
        "phone": null,
        "verified_email": true,
        "addresses": [{
            "address1": "",
            "address2": "",
            "city": "",
            "province": "City of London",
            "phone": "19876543210",
            "zip": "",
            "first_name": "john",
            "last_name": "doe",
            "country": "United Kingdom",
            "company": ""
        }],
        "password": "Suraut^23",
        "password_confirmation": "Suraut^23"
    }
}

and getting this exception from API

Error: StatusCodeError: 422 - {"errors":{"addresses.province":["is not valid"]}}

 

 

Replies 0 (0)