Add client method for /api/v2/jobs/{id}/errors endpoint
jasonfagerberg-toast opened this issue · 3 comments
Describe the problem you'd like to have solved
Method to get error details for a failed job (i.e. call /api/v2/jobs/{id}/errors
)
Describe the ideal solution
Something like
/**
* Get error details of a failed job. A token with scope create:users is needed.
* See https://auth0.com/docs/api/management/v2#!/Jobs/get_errors.
*
* @param jobId the id of the job to retrieve.
* @return a Request to execute.
*/
public Request<List<JobErrorDetails>> getErrorDetails(String jobId) {
Asserts.assertNotNull(jobId, "job id");
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/jobs")
.addPathSegment(jobId)
.addPathSegment("errors")
.build()
.toString();
CustomRequest<List<JobErrorDetails>> request = new CustomRequest<>(client, url, "GET", new TypeReference<List<JobErrorDetails>>() {
});
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
Alternatives and current work-arounds
Current woraround: call the endpoint myself using a different HTTP client + POJOs
Additional information, if any
I already coded this solution but it looks like I do not have access to open PRs against this repo. Will attach my changed / new files for reference
Thanks for raisin @jasonfagerberg-toast - I don't think there's any reason we can't support this API. No special permissions should be required to create a PR, can you describe the issue you are seeing? Or if you are working on a fork and want to share a link to a commit there, might make it easier to grab the diff. That said, would like to figure out and fix why you can't make a PR here, since you already have a solution. Thanks!
@jimmyjames Not working off a fork or anything like that, when I try to push my branch to remote I get this error
auth0-java % git push origin get-job-error-deatils-client
ERROR: Permission to auth0/auth0-java.git denied to jasonfagerberg-toast.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
so maybe something is funny with using my work SSH keys, I can dig into that
Created a fork and a PR here #383