customer_segments_api = client.customer_segments
CustomerSegmentsApi
Retrieves the list of customer segments of a business.
def list_customer_segments(self,
cursor=None,
limit=None)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
str |
Query, Optional | A pagination cursor returned by previous calls to ListCustomerSegments .This cursor is used to retrieve the next set of query results. For more information, see Pagination. |
limit |
int |
Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the specified limit is less than 1 or greater than 50, Square returns a 400 VALUE_TOO_LOW or 400 VALUE_TOO_HIGH error. The default value is 50.For more information, see Pagination. |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type List Customer Segments Response
.
result = customer_segments_api.list_customer_segments()
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Retrieves a specific customer segment as identified by the segment_id
value.
def retrieve_customer_segment(self,
segment_id)
Parameter | Type | Tags | Description |
---|---|---|---|
segment_id |
str |
Template, Required | The Square-issued ID of the customer segment. |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type Retrieve Customer Segment Response
.
segment_id = 'segment_id4'
result = customer_segments_api.retrieve_customer_segment(segment_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)