Historical Adherence Issue

I have been trying to get the Historical Adherence data for a list of users within a certain time frame. For a few days, I was able to generate a jobId, and check on that job status to get the downloadurl. But randomly, it will now tell me that the Job doesnt not exist. I'm not sure what is going on, but I have been reading multiple forum posts about setting up a Notification Channel, which I was advised that I shouldnt need to be doing that. Friday, there was only 1 channel, now I have about 7 for some reason.

Steps
What I’m doing is this,

  1. Run this api /api/v2/workforcemanagement/adherence/historical in order start a job to generate the download URL that will have the data generated. This process is fine and I get a Job ID returned to me, with a queryState of Processing
  2. Using that JobId, I then check the status of the job using /api/v2/workforcemanagement/adherence/historical/jobs/{jobId} which should tell me if it is complete or not, and return a download URL that will give me the data needed.

I have received DownloadURLs numerous times when I am either running it locally on my VS console project, or if I am just testing it on developer.genesys.cloud api explorer.

But occasionally I will receive a 404 Error saying there was no query job with that jobId. Can someone please explain what I am doing wrong, or why this might be happening?

Hi mberman,

There is a known issue around the GET endpoint that can cause this to happen. The issue has been fixed in our development environment and should be available very soon to all users. In the meantime, have you tried waiting a few seconds before making the GET request? The job should show up and stop returning 404 after a certain point in time. Normally it should only be a few seconds at most, but if you or other users are leveraging the api/v2/workforcemanagement/adherence/historical endpoint heavily, it possibly could take a long time.

If you run into an issue with jobs taking a long time to complete after the bug fix is available, you can switch your approach and group your users by management unit and make multiple requests using the /api/v2/workforcemanagement/managementunits/{managementUnitId}/historicaladherencequery endpoint instead. This is generally what we recommend for querying historical adherence data.

2 Likes

I appreciate the response and I did wait a few seconds when I ran my project and while on the Dev tools site. Im not sure if having a bunch of random Notification Channels had any bearing on my inconsistency, but this morning I have not ran into any issues.

The notification channels would have no effect on whether or not you got a 404. I can say that the bug fix is now deployed across all regions so you shouldn't run into this issue anymore.

1 Like

So an update to this thread, I have figured out that I may not be able to use this Api call at all. I found out that checking the status of that adherence job uses the NotificationsAPI. So I followed Joe Behymer thread (How To Get Historical Adherence) and I was stuck once I got to step 4. Subscribe to Topics. That step requires using a userId when assigning topics. My issue is I am not a user from the looks of it. When I run my program, and call
/api/v2/users/me , it throws an error because it doesnt recognize me as a user. My best guess is because I am using Client Credentials Grant auth.