Description :
Language: Java 8, Framework: Spring Boot
Build type: maven
Tool: Sring Tool Suite
Here I implemented this Google Cloud talent solution API for job search below code :
Code :
GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream(credentialsPath));
// Create a JobServiceClient instance and authenticate with credentials
JobServiceClient jobServiceClient = JobServiceClient.create(JobServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credentials))
.build());
// Create a request to list jobs
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(String.format("projects/%s",com.google.cloud.ServiceOptions.getDefaultProjectId()))
.setFilter(" java developers jobs in XYZ country")
.setPageSize(10)
.build();
// Execute the API request and retrieve the response
ListJobsPagedResponse response = jobServiceClient.listJobs(request);
// Print out the job details
for (com.google.cloud.talent.v4.Job job: response.iterate()) {
System.out.printf("Job name: %s, job title: %s, job description: %s\n",
job.getName(), job.getTitle(), job.getDescription());
}
// Clean up resources
jobServiceClient.close();
Authentication is successfully done after that API call it gives error like :
io.grpc.StatusRuntimeException: PERMISSION_DENIED
{
"code": 403,
"errors" : [ {
"domain": "global",
"message": "The caller does not have permission",
"reason" : "forbidden"
} ],
"message" : "The caller does not have permission",
"status" : "PERMISSION_DENIED"
}]
So, Anyone who knows about this error or what kind of permission is required to resolve this error any kind of reference please share it is great for me.