cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get Customer Addresses return empty list

Former Member
0 Kudos
296

Hello All ,

I am trying to use the OOTB web service for getting the customer addresses

  https://localhost:9002/rest/v2/powertools/users/01110005978/addresses?fields=DEFAULT
  GET /{baseSiteId}/users/{userId}/addresses

But it returns an empty list of addresses although those customers has many addresses.

Any idea what to do ?

Accepted Solutions (0)

Answers (2)

Answers (2)

arvind-kumar_avinash
Active Contributor
0 Kudos

As you have mentioned, I am assuming that the customer (e.g. anil.gupta@rustic-hw.com) has at least one address. I have added an address to this user for demo purpose.

Go to backoffice > Addresses > Select the customer address (e.g. anil.gupta@rustic-hw.com) > Change is shipping address to true under ADDRESS TYPES on the GENERAL tab > SAVE

Now, you can send the following GET request using a REST client (e.g. Postman)

 https://localhost:8002/rest/v2/powertools/users/anil.gupta@rustic-hw.com/addresses

And you will get a response like:

 {
     "addresses": [
         {
             "country": {
                 "isocode": "GB"
             },
             "defaultAddress": true,
             "firstName": "Anil",
             "id": "8796125822999",
             "lastName": "Gupta",
             "line1": "Wigmore House",
             "line2": "Wigmore Lane",
             "postalCode": "LU2 9TN",
             "town": "Luton"
         }
     ]
 }

Note: Please make sure to use the Access Token created for the user, anil.gupta@rustic-hw.com; otherwise, you get the error, Access is denied.

Please let me know if you face any further issue.

VinayKumarS
Active Contributor
0 Kudos

To get the cusomer address. Go and add the address to customer first. Then use below url

https://powertools.ms.ycs.io:9002/trainingcommercewebservices/v2/powertools/users/mark.rivers@rustic...

here it is pk of the address id. 8796125822999