TS Commerce Developers

B2B API

Current version: v1.1

To use this api your shop need to have the B2B module enabled

List Listings

List all listings available on current store

GET
/b2b/list_listing.json
List Listings Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->get('/b2b/list_listing.json');
					
List Listings Response

					[
    {
        "id": "62cc44ffd4029d4f1c7bbd91",
        "customers_group": "62cc44ffd4029d4f1c7bbd92",
        "description": "",
        "name": "EntepriseB2B"
    },
    {
        "id": "62cd232dd4029d3d1c7bbd8c",
        "customers_group": "62cd232dd4029d3d1c7bbd8d",
        "description": "",
        "name": "VIP Customers"
    },
	...
]
					

Create Listing

List all orders updated in a defined time-span

Notice !

Please note that create a new listing create a new custom produtct attribute suffixed with " - price" and a new customer group

POST
/b2b/listing.json
name required(string) Specify the customer group name
description (string)
Create Listing Request

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

$payload = array();
$payload['name'] = 'Vip Customer',
$payload['description'] = 'Vip customer, based on company rules';

$result = $storeden->post('/b2b/listing.json', $payload);
					
Create Listing Response

					{
    "id": "62cd3144d4029ddc1e7bbd8a",
    "customers_group": "62cd3144d4029ddc1e7bbd8b",
    "description": "Vip customer, based on company rules",
    "name": "VIP Customers"
}
					

Remove Listing

Remove listing

Notice !

Please note that removing a listing will preserve the customer group ( without listing associate ) and the product attribute will be removed

DELETE
/b2b/listing.json
id required(Storeden ID)
Remove Listing Request

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

$payload = array();
$payload['id'] = '62cd3144d4029ddc1e7bbd8a',

$result = $storeden->delete('/b2b/listing.json', $payload);
					
Remove Listing Response

{
    "customers_group": {
        "id": "62cd1e7ed4029d3c1c7bbe41",
        "listing": {
            "removed": true
        }
    },
    "listing": {
        "id": "62cd3144d4029ddc1e7bbd8a",
        "attribute": {
            "removed": true
        }
    }
}
					

Create B2B Access

Create a new b2b access

POST
/b2b/user.json
email required(string)
fullname required(string)
customer_group_id required(string)
send_email (string) Set this field to "yes" to send welcome email to user
Create b2b access Request

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

$payload = array();
$payload['email'] = 'test@domain.tld',
$payload['fullname'] = 'Mario Rossi',
$payload['customer_group_id'] = '62cd232dd4029d3d1c7bbd8d',

$result = $storeden->post('/b2b/user.json', $payload);
					
Create b2b access Response

{
    "user": {
        "created": true,
	},
	"customer_group":{
		"associated": true
	}
}
					

List shop sccount

List all account

GET
/b2b/users_list.json
List shop sccount Request

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

$payload = array();

$result = $storeden->get('/b2b/users_list.json', $payload);
					
List shop sccount Response

{
    "count": 37,
    "users": [
        {
            "id": 1309180,
            "email": "test-email1@email.tld",
            "registration_date": "2019-04-03T16:41:57+02:00",
            "registration_status": "ask-for-removal"
        },
        {
            "id": 1325570,
            "email": "test-email2@email.tld",
            "registration_date": "2019-04-15T11:58:26+02:00",
            "registration_status": "active"
        },
		...
}
					

Remove shop account

Remove a specific account

DELETE
/b2b/user.json
email required *(string) * one of email or uid is required
uid required *(int)
customer (string) Specify "delete" to complete remove the Customer profile, if not specified the customer will be moved into "guest" state
Remove shop account Request

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

$payload = array();
$payload['uid'] = 1309180,
//$payload['email'] = 'test@domain.tld',
$payload['customer'] = 'delete',

$result = $storeden->delete('/b2b/user.json', $payload);
					
Create b2b access Response

{
    "ok": 1,
    "n": 1,
    "err": null,
    "errmsg": null,
    "customer": {
        "action": "deleted",
        "customer_id": "6481c472d4029d560a7b23d3"
    }
}