There are API's available to fetch and delete address of a customer but not create a new one.
GET /V1/customers/addresses/:addressId
GET /V1/customers/me/billingAddress
GET /V1/customers/:customerId/billingAddress
GET /V1/customers/me/shippingAddress
GET /V1/customers/:customerId/shippingAddress
DELETE /V1/addresses/:addressId
POST Api's are not available publicly?
Best Answer
I was having a similar problem and was digging into the AccountManagement class to find the proper payload. I noticed that the createAccount function checks if a customer ID exists and loads the stored data.
By performing a
POST /V1/customers/:id
, I was able to add another address with the following payload:By post method how did you do this actually when i am trying it is showing me error of missing route did you write webapi.xml code for this route.
Another Way:
add endp point app/code/YourCompany/Customer/etc/webapi.xml
Body:
If Update Existing address add addressID on body preload:
Post: http://yourstore.com/rest/V1/addresses [admin integration token]
[get CustomerID http://yourstore.com/rest/V1/customers/me getMethod customer token]