v1_employees_api = client.v1_employees
V1EmployeesApi
- List Employees
- Create Employee
- Retrieve Employee
- Update Employee
- List Employee Roles
- Create Employee Role
- Retrieve Employee Role
- Update Employee Role
Provides summary information for all of a business's employees.
def list_employees(self,
order=None,
begin_updated_at=None,
end_updated_at=None,
begin_created_at=None,
end_created_at=None,
status=None,
external_id=None,
limit=None,
batch_token=None)
Parameter | Type | Tags | Description |
---|---|---|---|
order |
str (Sort Order) |
Query, Optional | The order in which employees are listed in the response, based on their created_at field. Default value: ASC |
begin_updated_at |
string |
Query, Optional | If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format |
end_updated_at |
string |
Query, Optional | If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. |
begin_created_at |
string |
Query, Optional | If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. |
end_created_at |
string |
Query, Optional | If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. |
status |
str (V1 List Employees Request Status) |
Query, Optional | If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). |
external_id |
string |
Query, Optional | If provided, the endpoint returns only employee entities with the specified external_id. |
limit |
int |
Query, Optional | The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. |
batch_token |
string |
Query, Optional | A pagination cursor to retrieve the next set of results for your original query to the endpoint. |
order = 'DESC'
begin_updated_at = 'begin_updated_at6'
end_updated_at = 'end_updated_at4'
begin_created_at = 'begin_created_at6'
end_created_at = 'end_created_at8'
status = 'ACTIVE'
external_id = 'external_id6'
limit = 172
batch_token = 'batch_token2'
result = v1_employees_api.list_employees(order, begin_updated_at, end_updated_at, begin_created_at, end_created_at, status, external_id, limit, batch_token)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Use the CreateEmployee endpoint to add an employee to a Square
account. Employees created with the Connect API have an initial status
of INACTIVE
. Inactive employees cannot sign in to Square Point of Sale
until they are activated from the Square Dashboard. Employee status
cannot be changed with the Connect API.
Employee entities cannot be deleted. To disable employee profiles,
set the employee's status to INACTIVE
def create_employee(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
V1 Employee |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
body = {}
body['id'] = 'id6'
body['first_name'] = 'first_name6'
body['last_name'] = 'last_name4'
body['role_ids'] = ['role_ids0', 'role_ids1']
body['authorized_location_ids'] = ['authorized_location_ids7', 'authorized_location_ids8']
body['email'] = 'email0'
body['status'] = 'ACTIVE'
result = v1_employees_api.create_employee(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Provides the details for a single employee.
def retrieve_employee(self,
employee_id)
Parameter | Type | Tags | Description |
---|---|---|---|
employee_id |
string |
Template, Required | The employee's ID. |
employee_id = 'employee_id0'
result = v1_employees_api.retrieve_employee(employee_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
UpdateEmployee
def update_employee(self,
employee_id,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
employee_id |
string |
Template, Required | The ID of the role to modify. |
body |
V1 Employee |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
employee_id = 'employee_id0'
body = {}
body['id'] = 'id6'
body['first_name'] = 'first_name6'
body['last_name'] = 'last_name4'
body['role_ids'] = ['role_ids0', 'role_ids1']
body['authorized_location_ids'] = ['authorized_location_ids7', 'authorized_location_ids8']
body['email'] = 'email0'
body['status'] = 'ACTIVE'
result = v1_employees_api.update_employee(employee_id, body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Provides summary information for all of a business's employee roles.
def list_employee_roles(self,
order=None,
limit=None,
batch_token=None)
Parameter | Type | Tags | Description |
---|---|---|---|
order |
str (Sort Order) |
Query, Optional | The order in which employees are listed in the response, based on their created_at field.Default value: ASC |
limit |
int |
Query, Optional | The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. |
batch_token |
string |
Query, Optional | A pagination cursor to retrieve the next set of results for your original query to the endpoint. |
order = 'DESC'
limit = 172
batch_token = 'batch_token2'
result = v1_employees_api.list_employee_roles(order, limit, batch_token)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Creates an employee role you can then assign to employees.
Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a "Shift Manager" role might be able to issue refunds in Square Point of Sale, whereas an employee with a "Clerk" role might not.
Roles are assigned with the V1UpdateEmployee endpoint. An employee can have only one role at a time.
If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.
def create_employee_role(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
V1 Employee Role |
Body, Required | An EmployeeRole object with a name and permissions, and an optional owner flag. |
body = {}
body['id'] = 'id6'
body['name'] = 'name6'
body['permissions'] = ['REGISTER_APPLY_RESTRICTED_DISCOUNTS', 'REGISTER_CHANGE_SETTINGS', 'REGISTER_EDIT_ITEM']
body['is_owner'] = False
body['created_at'] = 'created_at4'
body['updated_at'] = 'updated_at8'
result = v1_employees_api.create_employee_role(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Provides the details for a single employee role.
def retrieve_employee_role(self,
role_id)
Parameter | Type | Tags | Description |
---|---|---|---|
role_id |
string |
Template, Required | The role's ID. |
role_id = 'role_id6'
result = v1_employees_api.retrieve_employee_role(role_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)
Modifies the details of an employee role.
def update_employee_role(self,
role_id,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
role_id |
string |
Template, Required | The ID of the role to modify. |
body |
V1 Employee Role |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
role_id = 'role_id6'
body = {}
body['id'] = 'id6'
body['name'] = 'name6'
body['permissions'] = ['REGISTER_APPLY_RESTRICTED_DISCOUNTS', 'REGISTER_CHANGE_SETTINGS', 'REGISTER_EDIT_ITEM']
body['is_owner'] = False
body['created_at'] = 'created_at4'
body['updated_at'] = 'updated_at8'
result = v1_employees_api.update_employee_role(role_id, body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.body)