Description:
Code:
String projectId = "*****";
String tenantId = "***-ay7tp";
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
// Construct the list jobs request
ListJobsRequest.Builder requestBuilder = ListJobsRequest.newBuilder()
.setParent("projects/" + projectId + "/tenants/" + tenantId).setFilter("status = \"OPEN\"")
.setJobView(JobView.JOB_VIEW_FULL); // specify which fields to include in the response
// Use the JobServiceClient to list the jobs
ListJobsPagedResponse response1 = jobServiceClient.listJobs(requestBuilder.build());
System.out.println(response1.toString());
TenantName parent = TenantName.of(projectId, tenantId);
ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString())
.setFilter("status = \"OPEN\"").build();
// Print the details of the first 10 jobs in the response
int count = 0;
for (com.google.cloud.talent.v4.Job job : jobServiceClient.listJobs(request).iterateAll()) {
System.out.println("Job title: " + job.getTitle());
System.out.println("Job description: " + job.getDescription());
System.out.println("Job posting date: " + job.getPostingPublishTime().toString());
System.out.println("Job company name: " + job.getCompanyDisplayName());
System.out.println("Job ID: " + job.getName().substring(job.getName().lastIndexOf("/") + 1));
System.out.println("----------------------------------------");
count++;
if (count >= 10) {
break;
}
}
}
error:
NOT_FOUND: Tenant with name projects//tenants/ not found.
Request ID for tracking: -*****-48e8-961e-:***********==