Get Customer Data REST API from the customer ID using the V1/customers/:customerId endpoint in Magento 2.
V1/customers/:customerId Used to Retrieve Customer Details in Magento by Customer Id.
Action: GET
URL: <URL>/rest/V1/<store_code>/customers/me/:customerId
(Example, http://magento246.docker/rest/default/V1/customers/me/10)
HEADER:
Authorization: Bearer <ADMIN_TOKEN>
You have to pass the admin token detail as HEADER Authorization from the link, Generate the Admin token Rest API
RESPONSE:
{
"id": 10,
"group_id": 5,
"default_billing": "3",
"default_shipping": "3",
"created_at": "2021-03-29 08:56:35",
"updated_at": "2021-04-01 12:27:23",
"created_in": "Default Store View",
"email": "rakehs@patel.com",
"firstname": "Ram",
"lastname": "Patel",
"gender": 1,
"store_id": 2,
"website_id": 2,
"addresses": [
{
"id": 3,
"customer_id": 10,
"region": {
"region_code": "MI",
"region": "Michigan",
"region_id": 33
},
"region_id": 33,
"country_id": "US",
"street": [
"Ear Guru Street"
],
"company": "Samsung",
"telephone": "49628-7978",
"postcode": "70707",
"city": "Ervin",
"firstname": "John",
"lastname": "Huges",
"default_shipping": true,
"default_billing": true
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 10,
"company_id": 15,
"status": 1
},
"is_subscribed": false
},
"custom_attributes": [
{
"attribute_code": "attribute_name",
"value": "0"
}
]
}
Using the above way, You can get customer data with REST API.
