List addresses
List all available addresses of a user.
GET
/useraccount/addresses.json
GET PARAMETERS LIST
uid required (int) | Unique identifier of the user whose list of addresses you want to retrieve. |
List all available addresses of a user.
GET
/useraccount/addresses.json
uid required (int) | Unique identifier of the user whose list of addresses you want to retrieve. |
$storeden = new Storeden\Storeden($config);
$addresses_list = $storeden->get('/useraccount/addresses.json?uid=userUID');
[
"count":1
"addresses": [
{
"id": "665dbe34d4029d4d228f8df5",
"fullname": "John Doe",
"email": "john.doe@example.com",
"phone": "3281234567",
"tax_code": "DOEJHN85A01F205Z",
"address": "Via Roma, 10",
"city": "Padova",
"postal_code": "35100",
"state": "6482",
"stateName": "Padova",
"country": "119",
"countryName": "Italia",
"principalAddress": true,
"hidden": false,
"metadata": {
"address_name": null
}
}
]
]
Add a new address to a user.
POST
/useraccount/address.json
uid required (int) | Unique identifier of the user to whom the address is being added. |
fullname required (string) | Full name of the customer associated with this address. |
email required (string) | Email address of the customer associated with this address. |
phone (string) | Phone number of the customer. |
tax_code (string) | Tax code or fiscal identifier of the customer. |
address required (string) | Street name and house number of the address. |
postal_code required (string) | Postal code (ZIP code) for the address. |
city required (string) | City where the address is located. |
state required (string) | State or region identifier for the address. |
country required (string) | Country code or identifier for the address. |
default (int) | If set to 1 , the address will be marked as the primary address. |
metadata[] repeatable (string) | Additional metadata for the address, such as custom attributes. |
$storeden = new Storeden\Storeden($config);
$payload = array();
$payload['uid'] = 'userUID';
$payload['fullname'] = 'John Doe';
$payload['email'] = 'john.doe@example.com';
$payload['phone'] = '3281234567';
$payload['tax_code'] = 'DOEJHN85A01F205Z';
$payload['address'] = 'Via Roma, 10';
$payload['postal_code'] = '35100';
$payload['city'] = 'Padova';
$payload['state'] = '6482';
$payload['country'] = '119';
$payload['default'] = 1;
$payload['metadata']['address_name'] = 'Address Name';
$result = $storeden->post('/useraccount/address.json', $payload);
{
"id": "586bcb33ffe48ea8bec21ff4",
"principalAddress": "true",
"countryName": "Italia",
"stateName": "Padova"
}
Edit a user address.
PUT
/useraccount/address.json
address_id required (string) | Unique identifier of the address to be updated. |
uid required (int) | Unique identifier of the user to whom the address is being updated. |
fullname required (string) | Full name of the customer associated with this address. |
email required (string) | Email address of the customer associated with this address. |
phone (string) | Phone number of the customer. |
tax_code (string) | Tax code or fiscal identifier of the customer. |
address required (string) | Street name and house number of the address. |
postal_code required (string) | Postal code (ZIP code) for the address. |
city required (string) | City where the address is located. |
state required (string) | State or region identifier for the address. |
country required (string) | Country code or identifier for the address. |
default (int) | If set to 1 , the address will be marked as the primary address. |
metadata[] repeatable (string) | Additional metadata for the address, such as custom attributes. |
$storeden = new Storeden\Storeden($config);
$payload = array();
$payload['address_id'] = '586bcb33ffe48ea8bec21ff4';
$payload['uid'] = 'userUID';
$payload['fullname'] = 'John Doe';
$payload['email'] = 'john.doe@example.com';
$payload['phone'] = '3281234567';
$payload['tax_code'] = 'DOEJHN85A01F205Z';
$payload['address'] = 'Via Roma, 10';
$payload['postal_code'] = '35100';
$payload['city'] = 'Padova';
$payload['state'] = '6482';
$payload['country'] = '119';
$payload['default'] = 1;
$payload['metadata']['address_name'] = 'Address Name';
$result = $storeden->put('/useraccount/address.json', $payload);
{
"id": "586bcb33ffe48ea8bec21ff4",
"principalAddress": "true",
"countryName": "Italia",
"stateName": "Padova"
}
Remove an existing address from a user.
DELETE
/useraccount/address.json
address_id required (string) | Unique identifier of the address to be deleted. |
uid required (int) | Unique identifier of the user to whom the address is being deleted. |
$storeden = new Storeden\Storeden($config);
$payload = array();
$payload['address_id'] = '586bcb33ffe48ea8bec21ff4';
$payload['uid'] = 'userUID';
$result = $storeden->delete('/useraccount/address.json', $payload);
{
"success": "true",
"error_message": "",
"data": {
"id": "586bcb33ffe48ea8bec21ff4",
"action": "DELETE"
}
}