customer_groups_api = client.customer_groups
CustomerGroupsApi
- List Customer Groups
- Create Customer Group
- Delete Customer Group
- Retrieve Customer Group
- Update Customer Group
Retrieves the list of customer groups of a business.
def list_customer_groups(self,
cursor=None)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query. For more information, see Pagination. |
cursor = 'cursor6'
result = customer_groups_api.list_customer_groups(cursor)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Creates a new customer group for a business.
The request must include the name
value of the group.
def create_customer_group(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Create Customer Group Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Create Customer Group Response
body = {}
body['idempotency_key'] = 'idempotency_key2'
body['group'] = {}
body['group']['id'] = 'id4'
body['group']['name'] = 'Loyal Customers'
body['group']['created_at'] = 'created_at2'
body['group']['updated_at'] = 'updated_at0'
result = customer_groups_api.create_customer_group(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Deletes a customer group as identified by the group_id
value.
def delete_customer_group(self,
group_id)
Parameter | Type | Tags | Description |
---|---|---|---|
group_id |
string |
Template, Required | The ID of the customer group to delete. |
Delete Customer Group Response
group_id = 'group_id0'
result = customer_groups_api.delete_customer_group(group_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Retrieves a specific customer group as identified by the group_id
value.
def retrieve_customer_group(self,
group_id)
Parameter | Type | Tags | Description |
---|---|---|---|
group_id |
string |
Template, Required | The ID of the customer group to retrieve. |
Retrieve Customer Group Response
group_id = 'group_id0'
result = customer_groups_api.retrieve_customer_group(group_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Updates a customer group as identified by the group_id
value.
def update_customer_group(self,
group_id,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
group_id |
string |
Template, Required | The ID of the customer group to update. |
body |
Update Customer Group Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Update Customer Group Response
group_id = 'group_id0'
body = {}
body['group'] = {}
body['group']['id'] = 'id4'
body['group']['name'] = 'Loyal Customers'
body['group']['created_at'] = 'created_at2'
body['group']['updated_at'] = 'updated_at0'
result = customer_groups_api.update_customer_group(group_id, body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)