ITeamApi teamApi = client.TeamApi;
TeamApi
- Create Team Member
- Bulk Create Team Members
- Bulk Update Team Members
- List Jobs
- Create Job
- Retrieve Job
- Update Job
- Search Team Members
- Retrieve Team Member
- Update Team Member
- Retrieve Wage Setting
- Update Wage Setting
Creates a single TeamMember
object. The TeamMember
object is returned on successful creates.
You must provide the following values in your request to this endpoint:
given_name
family_name
Learn about Troubleshooting the Team API.
CreateTeamMemberAsync(
Models.CreateTeamMemberRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateTeamMemberRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateTeamMemberResponse>
CreateTeamMemberRequest body = new CreateTeamMemberRequest.Builder()
.IdempotencyKey("idempotency-key-0")
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_1")
.Status("ACTIVE")
.GivenName("Joe")
.FamilyName("Doe")
.EmailAddress("[email protected]")
.PhoneNumber("+14159283333")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("EXPLICIT_LOCATIONS")
.LocationIds(
new List<string>
{
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT",
})
.Build())
.WageSetting(
new WageSetting.Builder()
.JobAssignments(
new List<JobAssignment>
{
new JobAssignment.Builder(
"SALARY"
)
.AnnualRate(
new Money.Builder()
.Amount(3000000L)
.Currency("USD")
.Build())
.WeeklyHours(40)
.JobId("FjS8x95cqHiMenw4f1NAUH4P")
.Build(),
new JobAssignment.Builder(
"HOURLY"
)
.HourlyRate(
new Money.Builder()
.Amount(2000L)
.Currency("USD")
.Build())
.JobId("VDNpRv8da51NU8qZFC5zDWpF")
.Build(),
})
.IsOvertimeExempt(true)
.Build())
.Build())
.Build();
try
{
CreateTeamMemberResponse result = await teamApi.CreateTeamMemberAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates multiple TeamMember
objects. The created TeamMember
objects are returned on successful creates.
This process is non-transactional and processes as much of the request as possible. If one of the creates in
the request cannot be successfully processed, the request is not marked as failed, but the body of the response
contains explicit error information for the failed create.
Learn about Troubleshooting the Team API.
BulkCreateTeamMembersAsync(
Models.BulkCreateTeamMembersRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkCreateTeamMembersRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.BulkCreateTeamMembersResponse>
BulkCreateTeamMembersRequest body = new BulkCreateTeamMembersRequest.Builder(
new Dictionary<string, CreateTeamMemberRequest>
{
["idempotency-key-1"] = new CreateTeamMemberRequest.Builder()
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_1")
.GivenName("Joe")
.FamilyName("Doe")
.EmailAddress("[email protected]")
.PhoneNumber("+14159283333")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("EXPLICIT_LOCATIONS")
.LocationIds(
new List<string>
{
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT",
})
.Build())
.Build())
.Build(),
["idempotency-key-2"] = new CreateTeamMemberRequest.Builder()
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_2")
.GivenName("Jane")
.FamilyName("Smith")
.EmailAddress("[email protected]")
.PhoneNumber("+14159223334")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("ALL_CURRENT_AND_FUTURE_LOCATIONS")
.Build())
.Build())
.Build(),
}
)
.Build();
try
{
BulkCreateTeamMembersResponse result = await teamApi.BulkCreateTeamMembersAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates multiple TeamMember
objects. The updated TeamMember
objects are returned on successful updates.
This process is non-transactional and processes as much of the request as possible. If one of the updates in
the request cannot be successfully processed, the request is not marked as failed, but the body of the response
contains explicit error information for the failed update.
Learn about Troubleshooting the Team API.
BulkUpdateTeamMembersAsync(
Models.BulkUpdateTeamMembersRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkUpdateTeamMembersRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.BulkUpdateTeamMembersResponse>
BulkUpdateTeamMembersRequest body = new BulkUpdateTeamMembersRequest.Builder(
new Dictionary<string, UpdateTeamMemberRequest>
{
["AFMwA08kR-MIF-3Vs0OE"] = new UpdateTeamMemberRequest.Builder()
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_2")
.Status("ACTIVE")
.GivenName("Jane")
.FamilyName("Smith")
.EmailAddress("[email protected]")
.PhoneNumber("+14159223334")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("ALL_CURRENT_AND_FUTURE_LOCATIONS")
.Build())
.Build())
.Build(),
["fpgteZNMaf0qOK-a4t6P"] = new UpdateTeamMemberRequest.Builder()
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_1")
.Status("ACTIVE")
.GivenName("Joe")
.FamilyName("Doe")
.EmailAddress("[email protected]")
.PhoneNumber("+14159283333")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("EXPLICIT_LOCATIONS")
.LocationIds(
new List<string>
{
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT",
})
.Build())
.Build())
.Build(),
}
)
.Build();
try
{
BulkUpdateTeamMembersResponse result = await teamApi.BulkUpdateTeamMembersAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Lists jobs in a seller account. Results are sorted by title in ascending order.
ListJobsAsync(
string cursor = null)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | The pagination cursor returned by the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination. |
try
{
ListJobsResponse result = await teamApi.ListJobsAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates a job in a seller account. A job defines a title and tip eligibility. Note that compensation is defined in a job assignment in a team member's wage setting.
CreateJobAsync(
Models.CreateJobRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateJobRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateJobResponse>
CreateJobRequest body = new CreateJobRequest.Builder(
new Job.Builder()
.Title("Cashier")
.IsTipEligible(true)
.Build(),
"idempotency-key-0"
)
.Build();
try
{
CreateJobResponse result = await teamApi.CreateJobAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves a specified job.
RetrieveJobAsync(
string jobId)
Parameter | Type | Tags | Description |
---|---|---|---|
jobId |
string |
Template, Required | The ID of the job to retrieve. |
Task<Models.RetrieveJobResponse>
string jobId = "job_id2";
try
{
RetrieveJobResponse result = await teamApi.RetrieveJobAsync(jobId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates the title or tip eligibility of a job. Changes to the title propagate to all
JobAssignment
, Shift
, and TeamMemberWage
objects that reference the job ID. Changes to
tip eligibility propagate to all TeamMemberWage
objects that reference the job ID.
UpdateJobAsync(
string jobId,
Models.UpdateJobRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
jobId |
string |
Template, Required | The ID of the job to update. |
body |
UpdateJobRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateJobResponse>
string jobId = "job_id2";
UpdateJobRequest body = new UpdateJobRequest.Builder(
new Job.Builder()
.Title("Cashier 1")
.IsTipEligible(true)
.Build()
)
.Build();
try
{
UpdateJobResponse result = await teamApi.UpdateJobAsync(
jobId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Returns a paginated list of TeamMember
objects for a business.
The list can be filtered by location IDs, ACTIVE
or INACTIVE
status, or whether
the team member is the Square account owner.
SearchTeamMembersAsync(
Models.SearchTeamMembersRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchTeamMembersRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.SearchTeamMembersResponse>
SearchTeamMembersRequest body = new SearchTeamMembersRequest.Builder()
.Query(
new SearchTeamMembersQuery.Builder()
.Filter(
new SearchTeamMembersFilter.Builder()
.LocationIds(
new List<string>
{
"0G5P3VGACMMQZ",
})
.Status("ACTIVE")
.Build())
.Build())
.Limit(10)
.Build();
try
{
SearchTeamMembersResponse result = await teamApi.SearchTeamMembersAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves a TeamMember
object for the given TeamMember.id
.
Learn about Troubleshooting the Team API.
RetrieveTeamMemberAsync(
string teamMemberId)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member to retrieve. |
Task<Models.RetrieveTeamMemberResponse>
string teamMemberId = "team_member_id0";
try
{
RetrieveTeamMemberResponse result = await teamApi.RetrieveTeamMemberAsync(teamMemberId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates a single TeamMember
object. The TeamMember
object is returned on successful updates.
Learn about Troubleshooting the Team API.
UpdateTeamMemberAsync(
string teamMemberId,
Models.UpdateTeamMemberRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member to update. |
body |
UpdateTeamMemberRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateTeamMemberResponse>
string teamMemberId = "team_member_id0";
UpdateTeamMemberRequest body = new UpdateTeamMemberRequest.Builder()
.TeamMember(
new TeamMember.Builder()
.ReferenceId("reference_id_1")
.Status("ACTIVE")
.GivenName("Joe")
.FamilyName("Doe")
.EmailAddress("[email protected]")
.PhoneNumber("+14159283333")
.AssignedLocations(
new TeamMemberAssignedLocations.Builder()
.AssignmentType("EXPLICIT_LOCATIONS")
.LocationIds(
new List<string>
{
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT",
})
.Build())
.Build())
.Build();
try
{
UpdateTeamMemberResponse result = await teamApi.UpdateTeamMemberAsync(
teamMemberId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves a WageSetting
object for a team member specified
by TeamMember.id
. For more information, see
Troubleshooting the Team API.
Square recommends using RetrieveTeamMember or SearchTeamMembers
to get this information directly from the TeamMember.wage_setting
field.
RetrieveWageSettingAsync(
string teamMemberId)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member for which to retrieve the wage setting. |
Task<Models.RetrieveWageSettingResponse>
string teamMemberId = "team_member_id0";
try
{
RetrieveWageSettingResponse result = await teamApi.RetrieveWageSettingAsync(teamMemberId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates or updates a WageSetting
object. The object is created if a
WageSetting
with the specified team_member_id
doesn't exist. Otherwise,
it fully replaces the WageSetting
object for the team member.
The WageSetting
is returned on a successful update. For more information, see
Troubleshooting the Team API.
Square recommends using CreateTeamMember or UpdateTeamMember
to manage the TeamMember.wage_setting
field directly.
UpdateWageSettingAsync(
string teamMemberId,
Models.UpdateWageSettingRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member for which to update the WageSetting object. |
body |
UpdateWageSettingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateWageSettingResponse>
string teamMemberId = "team_member_id0";
UpdateWageSettingRequest body = new UpdateWageSettingRequest.Builder(
new WageSetting.Builder()
.JobAssignments(
new List<JobAssignment>
{
new JobAssignment.Builder(
"SALARY"
)
.JobTitle("Manager")
.AnnualRate(
new Money.Builder()
.Amount(3000000L)
.Currency("USD")
.Build())
.WeeklyHours(40)
.Build(),
new JobAssignment.Builder(
"HOURLY"
)
.JobTitle("Cashier")
.HourlyRate(
new Money.Builder()
.Amount(2000L)
.Currency("USD")
.Build())
.Build(),
})
.IsOvertimeExempt(true)
.Build()
)
.Build();
try
{
UpdateWageSettingResponse result = await teamApi.UpdateWageSettingAsync(
teamMemberId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}