Workforce Management Adherence Historical with client credentials

Hello dear community.

I'm trying to do backend calculation of the average adherence per management unit.

I've found API
/api/v2/workforcemanagement/managementunits/{managementUnitId}/historicaladherencequery
and notification topic to get downloadUrls
v2.users.{id}.workforcemanagement.historicaladherencequery

The problem is that with current approach I cant use notification on backend as it requires current user permissions.

Is there any others solutions to do such calculations on beckend just with client credentials?

Best regards, Taras

Hi @Taras, thanks for reaching out.

The answer to your question is that you should use your oauth client ID in place of a user ID when subscribing to the topic. This topic automatically uses the client ID in place of a user ID if operating outside the context of a user.

I apologize that the documentation is not clear on this point; I have opened an internal task to update the documentation to specifically call this out, which should be worked soon. Thanks again!

Hi @brian.trezise

Thanks for the quick reply.

I would like to clarify.
Notification topic subscription requires access token. Regarding to the documentation, it requires current user permissions, access token of the current user. So subscription request should be done on behalf of the current user.

My question was around client credentials.
From your answer I understood that its not possible to make a subscription with client credentials.

Do you know any others options to get historical adherence?

Hello,

No.
You would create an OAuth Client (with Client Credentials Grant type), with necessary permissions assigned via Roles (configured at the OAuth Client level).
You request an access token using this OAuth Client clientId and clientSecret (using Client Credentials grant method).

You can then create a notification channel and subscribe to topics with this access token.
When requesting v2.users.{id}.workforcemanagement.historicaladherencequery, replace {id} with the clientId of your OAuth Client.
Then make the historicaladherencequery using the same access token (i.e. obtained via the Client Credentials OAuth client).

Regards,

2 Likes

Hi Jerome,
Thanks very much!

Now its much clear.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.