Storeden Developers

Customers API

Current version: v1.1 beta
Last Update: 2021/06/09

Customers are users (registered or not) who have interacted with your store, making orders or registering.

Customers List

GET
/clients/list.json
PARAMETERS LIST
created_at_from (unix timestamp) Return all customers where customer creation date is greater than {timestamp}. Must be used with created_at_to
created_at_to (unix timestamp) Return all customers where customer creation date is lower than {timestamp}.Must be used with created_at_from
updated_at_from (unix timestamp) Return all customers where customer update date is greater than {timestamp}.Must be used with updated_at_to
updated_at_to (unix timestamp) Return all customers where customer update date is lower than {timestamp}.Must be used with updated_at_from
nodes (string) Return available entity node, separated by ',': eg: nodes=custom_fields,fullname
List customers Request

$storeden = new Storeden\Storeden($config);
$customers_list = $storeden->get('/clients/list.json');
					
List customers Response

[
	{
		"fullname": "John Smith",
		"email": "john-smith@domain.tld",
		"last_name": "Smith",
		"first_name": "John",
		"created_at": "2018-07-14T09:28:52+02:00",
		"id": "5b49a6a4deddac755c8cee7a",
		"userUID": 0,
		"accept_marketing": false
	},
	...
]
						

Get Customer Details

View all information about a specified customer

GET
/clients/client.json?id={customer-id}
PARAMETERS LIST
id required* (StoredenId) Unique id of customer.
email required* (string) Email of your customer.
* one of this fields required
Get customers Request

$storeden = new Storeden\Storeden($config);
$customer_data = $storeden->get('/clients/client.json?id=5b49a6a4deddac755c8cee7a');

/** OR **/

$storeden = new Storeden\Storeden($config);
$customer_data = $storeden->get('/clients/client.json?email=john.smith@domain.tld');
					
Get customers Response

{
    "fullname": "John Smith",
    "website": "https://domain.com",
    "email": "john.smith@domain.tld",
    "phone": "+1 007 007 007",
    "mobile": "+10 07 007 007",
    "address": "3411 Las Vegas Blvd. South",
    "city": "Las Vegas",
    "zip": "NV89109",
    "state": "Nevada",
    "country": "254",
    "code": "",
    "userUID": 120007,
    "id": "5b49a6a4deddac755c8cee7a"
}
					

Add a new customer

POST
/clients/client.json
PARAMETERS LIST
fullname required (string)
email required (string) If already exists in your customer database will throw an error
website (string)
phone (string)
mobile (string)
address (string) Full address included apt number
city (string)
zip (string) Specify a valid postal code. Will be validated against country postal code rules
country (uid) A valid country uid
state (uid) Specified state must be a state of specified country. Otherways an error will be thrown
tax_number (string)
metadata (associative array) Sub values:
sdi: Italia Digitial Invoice code
pec: Italian Certified Email address
note (string) April 24th, 2019 Custom Text for customer's data
Create customer Request

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

$customer_data = array();
$customer_data['fullname'] = 'John Smith';
$customer_data['email'] = 'john.smith@domain.tld';
// etc..

$result = $storeden->post('/clients/client.json', $customer_data);
					
Create customer Response

{
    "client": {
        "id": "569d08bb16f46ac71e7b23c6"
    }
}
					

Update customer data

PUT
/clients/client.json
PARAMETERS LIST
id required (StoredenID)
fullname (string)
phone (string)
address (string) Full address included apt number
city (string)
zip (string) Specify a valid postal code. Will be validated against country postal code rules
region (string) State/Region
state (string) Country name
tax_number (string)
note (string) April 24th, 2019 Custom Text for customer's data
Update Customer Request

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

$customer_data = array();
$customer_data['id'] = '569d08bb16f46ac71e7b23c6';
$customer_data['note'] = 'Customer description';
$customer_data['fullname'] = 'John Smith';
// etc..

$result = $storeden->put('/clients/client.json', $customer_data);
					
Update Customer Response

{
    "ok": 1,
    "nModified": 1,
    "n": 1,
    "err": null,
    "updatedExisting": true
}
					

Remove customer from list

Permanently delete customer from your customers list.

DELETE
/clients/client.json
PARAMETERS LIST
id required (string)
Remove customer Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->delete('/clients/client.json', ['id' => '569d08bb16f46ac71e7b23c6']);
					
Remove customer Response

{
    "ok": 1,
    "err": null,
}

Assign customer to a group

PUT
/clients/client2group.json
PARAMETERS LIST
id required (StoredenID) Unique id of a specific customer
group_id required (StoredenID|null) Unique id of a customers group
Assign customer to group Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->put('/clients/client2group.json', ['id' => '569d08bb16f46ac71e7b23c6', 'group_id' => '59fb00b016f46afa7d0031da']);
					
Assign customer to group Response

{
    "id": "569d08bb16f46ac71e7b23c6",
    "group": {
        "before": "",
        "after": "59fb00b016f46afa7d0031da"
    }
}

Update customer tags

This API replaces all customer tags with the submitted tags.

POST
/clients/tags.json
PARAMETERS LIST
id required* (StoredenID) Unique id of a specific customer
email required* (string) Customer email
tags required (string) a list of tags separated by ","
* one of "id" or "email" is required. If passed both, will be used the "id"
Overwrite customer tag Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->post('/clients/tags.json', ['id' => '569d08bb16f46ac71e7b23c6', 'tags' => 'test_tag_3,test_tag1']);
					
Overwrite customer tag Response

{
    "ok": 1,
    "nModified": 1,
    "n": 1,
    "err": null,
}

Add tags to customer

Previous tag to customer will be keeped and applied only the specified tags that are not assigned to customer

PUT
/clients/tags.json
PARAMETERS LIST
id required* (StoredenID) Unique id of a specific customer
email required* (string) Customer email
tags required (string) a list of tags separated by ","
* one of "id" or "email" is required. If passed both, will be used the "id"
Add customer tag Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->put('/clients/tags.json', ['id' => '569d08bb16f46ac71e7b23c6', 'tags' => 'test_tag_3,test_tag5,test_tag1']);
					
Add customer tag Response

{
    "ok": 1,
    "nModified": 1,
    "n": 1,
    "err": null,
}

Remove tags to customer

DELETE
/clients/tags.json
PARAMETERS LIST
id required* (StoredenID) Unique id of a specific customer
email required* (string) Customer email
tags required (string) a list of tags separated by ","
* one of "id" or "email" is required. If passed both, will be used the "id"
Remove customer tag Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->delete('/clients/tags.json', ['id' => '569d08bb16f46ac71e7b23c6', 'tags' => 'test_tag5,test_tag1']);
					
Remove customer tag Response

{
    "ok": 1,
    "nModified": 1,
    "n": 1,
    "err": null,
}

Batch add tags to customers list

PUT
/clients/batchTags.json
PARAMETERS LIST
email[] required* (string) Insert one "email[]=email_address" for each customer you want to update
tags required (string) a list of tags separated by ","
* if you want to update all customers, use email=*
Batch add tags to customers list Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->put('/clients/batchTags.json', ['email' => '*', 'tags' => 'new_tag_1']);
					
Batch add tags to customers list Response

{
    "ok": 1,
    "nModified": 19248,
    "n": 1,
    "err": null,
}

Batch update tags to customers list

This API replaces all customer tags with the submitted tags.

POST
/clients/batchTags.json
PARAMETERS LIST
email[] required* (string) Insert one "email[]=email_address" for each customer you want to update
tags required (string) a list of tags separated by ","
* if you want to update all customers, use email=*
Batch update tags to customers list Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->post('/clients/batchTags.json', ['email' => '*', 'tags' => 'new_tag_2']);
					
Batch update tags to customers list Response

{
    "ok": 1,
    "nModified": 19248,
    "n": 1,
    "err": null,
}

Batch remove tag to customers list

DELETE
/clients/batchTags.json
PARAMETERS LIST
email[] required* (string) Insert one "email[]=email_address" for each customer you want to update
tag required (string) specify a single tag to remove, you can use wildcard like: test_tag* to remove all tags starting with test_tag
* if you want to update all customers, use email=*
Batch remove tag to customers list Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->delete('/clients/batchTags.json', ['email' => '*', 'tag' => 'new_tag*']);
					
Batch remove tag to customers list Response

{
    "ok": 1,
    "nModified": 19248,
    "n": 1,
    "err": null,
}