API to decode userGroupId

Describe the issue or problem
I get userGroupId for each author in but I do not know where to find the related string that decodes it.

Steps I took leading up to the issue
I sent the following API:
/submissions/{submissionId}/publications/{publicationId}
I can get all the authors and related infos, but I do not know how to decode the userGroupId
Is there a way or an API to decode the userGroupId for each context (journal or book)?

What application are you using?
OMP 3.3

Hi @joelfan,

We don’t currently have an endpoint for that, I’m afraid; but can you describe your use case a little further?

Thanks,
Alec Smecher
Public Knowledge Project Team

Of course I can.

We are using OMP 3.3 (and OJS 3.3) in production, and I produce statistics on Authors, issueing OMP/OJS API. I usually scan all submissions and then all publications. In the publication I find the groupId, which I assume to be the role of the Author. I don’t now how to decode this. It would be nice to have the description for each groupId number.

I noticed that the groupId decoding is different per context, by the way. That is reasonable, since we can have custom roles.

Hi @joelfan,

This is going to be a little clumsy, but you can to go the /api/v1/users endpoint and get a list of users; that contains the groups listing, including user group ID, role ID, name, etc.

As you’ve noted the user groups can be customized for each context (journal), so be careful about assuming that there will be one exactly named “Author”, for example. The role IDs will probably correspond to what you want, and are defined in Role.php (depending on your branch); they are hard-coded to the application. But for example an “Author” and “Translator” role (as shipped by default) both correspond to ROLE_ID_AUTHOR in the code, so it’ll be difficult to consistently establish finer-grained detail than what the role ID provides.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you Alec.

Indeed we use the /api/v1/users endpoint, but this is not including all the authors. There are authors that are not users. So, searching inside users will not give us the complete list of authors.

From what I have understood, the API /submissions/{submissionId}/publications/{publicationId} is the only endpoint that gives the list of authors. And that is fine. The only thing which is missing is the userGroupId decoding. I understand that there is no possibility to get a decoding of userGroupId. At least no endpoint.

Anyway, I got your considerations about the roles, thanks.

This topic was automatically closed after 10 days. New replies are no longer allowed.