Update Address
This API allows you to update an existing address for a customer in the system. You must pass the updated address fields in the request payload. The id parameter must be included to specify which address to update.
Endpoint:
api/customer/profile/addresses/{id}
HTTP Method:
POST
URL Parameters:
id
(required): The unique identifier of the address.
Updating an address will result in the creation of a new address object with a new ID, and the original address object will be marked as "soft deleted" to avoid data loss.
- Request Body:
Key | Type | Description |
---|---|---|
name | string | The name of the address, which can be "home", "work", or any other custom label |
address | string | The text of the address. |
city_id | integer | The city ID of the address. |
area_id | integer | The area ID of the address. |
district_id | integer | The district ID of the address. |
apartment | string | The apartment number of the address. |
building | string | The building number of the address. |
floor | string | The floor number of the address. |
landmark | string | A nearby landmark for the address. |
lat | string | The latitude coordinate of the address. |
lng | string | The longitude coordinate of the address. |
primary | boolean | A boolean value that indicates whether the address is the primary address for the customer. |
shop_name | string | The name of the shop associated with the address. |
shop_image | string | The image of the shop associated with the address. |
we have added the apartment, building, floor, landmark, lat, and lng parameters to the request payload. These parameters provide additional details about the address, such as the specific apartment or building number, the floor of the building, and a nearby landmark.
{
"name": "Home",
"city_id": 10,
"area_id": 334,
"district_id": null,
"address": "test",
"apartment": "10",
"building": "10",
"floor": "10",
"landmark": "test",
"shop_name": null,
"shop_image": null,
"primary": true,
"lat": "30.105444",
"lng": "31.369139"
}
- Success Response:
You can check more details about Address Resource.
{
"code": 200,
"data": {
//...
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
"addresses": [
{
"id": 49124,
"name": "Home",
"address": "test address",
"apartment": "1",
"building": "10",
"landmark": null,
"city_id": 10,
"area_id": 125,
"primary": false,
"lat": "30.105444",
"lng": "31.369139",
"district_id": null,
"floor": "1",
"language": "en",
"shop_name": null,
"shop_image": null,
"formatted_address_ar": "مبني 10, دور 1, شارع test address, شقة 1, المعادي, القاهرة",
"formatted_address_en": "building 10, floor 1, address test address, apartment 1, Maadi, Cairo",
//...
"area": {
"id": 125,
"name": "Maadi",
"name_ar": "المعادي",
"city_id": 10,
"active": true,
//...
},
"city": {
"id": 10,
"name": "Cairo",
"name_ar": "القاهرة",
"active": 1,
//...
},
"district": null
},
]
}
}
Check the following section to learn more about the Update Address API Reference