TeamApi teamApi = client.getTeamApi();
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.
CompletableFuture<CreateTeamMemberResponse> createTeamMemberAsync(
final 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. |
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(Arrays.asList(
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT"
))
.build())
.wageSetting(new WageSetting.Builder()
.jobAssignments(Arrays.asList(
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();
teamApi.createTeamMemberAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<BulkCreateTeamMembersResponse> bulkCreateTeamMembersAsync(
final 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. |
BulkCreateTeamMembersRequest body = new BulkCreateTeamMembersRequest.Builder(
new LinkedHashMap<String, CreateTeamMemberRequest>() {{
put("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(Arrays.asList(
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT"
))
.build())
.build())
.build());
put("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();
teamApi.bulkCreateTeamMembersAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<BulkUpdateTeamMembersResponse> bulkUpdateTeamMembersAsync(
final 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. |
BulkUpdateTeamMembersRequest body = new BulkUpdateTeamMembersRequest.Builder(
new LinkedHashMap<String, UpdateTeamMemberRequest>() {{
put("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());
put("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(Arrays.asList(
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT"
))
.build())
.build())
.build());
}}
)
.build();
teamApi.bulkUpdateTeamMembersAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Lists jobs in a seller account. Results are sorted by title in ascending order.
CompletableFuture<ListJobsResponse> listJobsAsync(
final String cursor)
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. |
teamApi.listJobsAsync(null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<CreateJobResponse> createJobAsync(
final 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. |
CreateJobRequest body = new CreateJobRequest.Builder(
new Job.Builder()
.title("Cashier")
.isTipEligible(true)
.build(),
"idempotency-key-0"
)
.build();
teamApi.createJobAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Retrieves a specified job.
CompletableFuture<RetrieveJobResponse> retrieveJobAsync(
final String jobId)
Parameter | Type | Tags | Description |
---|---|---|---|
jobId |
String |
Template, Required | The ID of the job to retrieve. |
String jobId = "job_id2";
teamApi.retrieveJobAsync(jobId).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<UpdateJobResponse> updateJobAsync(
final String jobId,
final 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. |
String jobId = "job_id2";
UpdateJobRequest body = new UpdateJobRequest.Builder(
new Job.Builder()
.title("Cashier 1")
.isTipEligible(true)
.build()
)
.build();
teamApi.updateJobAsync(jobId, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<SearchTeamMembersResponse> searchTeamMembersAsync(
final 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. |
SearchTeamMembersRequest body = new SearchTeamMembersRequest.Builder()
.query(new SearchTeamMembersQuery.Builder()
.filter(new SearchTeamMembersFilter.Builder()
.locationIds(Arrays.asList(
"0G5P3VGACMMQZ"
))
.status("ACTIVE")
.build())
.build())
.limit(10)
.build();
teamApi.searchTeamMembersAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Retrieves a TeamMember
object for the given TeamMember.id
.
Learn about Troubleshooting the Team API.
CompletableFuture<RetrieveTeamMemberResponse> retrieveTeamMemberAsync(
final String teamMemberId)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
String |
Template, Required | The ID of the team member to retrieve. |
String teamMemberId = "team_member_id0";
teamApi.retrieveTeamMemberAsync(teamMemberId).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Updates a single TeamMember
object. The TeamMember
object is returned on successful updates.
Learn about Troubleshooting the Team API.
CompletableFuture<UpdateTeamMemberResponse> updateTeamMemberAsync(
final String teamMemberId,
final 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. |
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(Arrays.asList(
"YSGH2WBKG94QZ",
"GA2Y9HSJ8KRYT"
))
.build())
.build())
.build();
teamApi.updateTeamMemberAsync(teamMemberId, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<RetrieveWageSettingResponse> retrieveWageSettingAsync(
final String teamMemberId)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
String |
Template, Required | The ID of the team member for which to retrieve the wage setting. |
String teamMemberId = "team_member_id0";
teamApi.retrieveWageSettingAsync(teamMemberId).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<UpdateWageSettingResponse> updateWageSettingAsync(
final String teamMemberId,
final 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. |
String teamMemberId = "team_member_id0";
UpdateWageSettingRequest body = new UpdateWageSettingRequest.Builder(
new WageSetting.Builder()
.jobAssignments(Arrays.asList(
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();
teamApi.updateWageSettingAsync(teamMemberId, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});