TS Commerce Developers

Addresses API

Current version: v1.1

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 addresses Request

						$storeden = new Storeden\Storeden($config);
						$addresses_list = $storeden->get('/useraccount/addresses.json?uid=userUID');
					
List addresses Response

						[
							"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 address

Add a new address to a user.

POST
/useraccount/address.json
PAYLOAD PARAMETERS LIST
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.
Add address Request

						$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);
					
Add address Response

						{
							"id": "586bcb33ffe48ea8bec21ff4",
							"principalAddress": "true",
							"countryName": "Italia",
							"stateName": "Padova"
						}
					

Edit address

Edit a user address.

PUT
/useraccount/address.json
PAYLOAD PARAMETERS LIST
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.
Edit address Request

						$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);
					
Edit address Response

						{
							"id": "586bcb33ffe48ea8bec21ff4",
							"principalAddress": "true",
							"countryName": "Italia",
							"stateName": "Padova"
						}
					

Delete address

Remove an existing address from a user.

DELETE
/useraccount/address.json
PAYLOAD PARAMETERS LIST
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.
Delete address Request

						$storeden = new Storeden\Storeden($config);

						$payload = array();
						$payload['address_id'] = '586bcb33ffe48ea8bec21ff4';
						$payload['uid'] = 'userUID';

						$result = $storeden->delete('/useraccount/address.json', $payload);
					
Delete address Response

						{
							"success": "true",
							"error_message": "",
							"data": {
								"id": "586bcb33ffe48ea8bec21ff4",
								"action": "DELETE"
							}
						}