How to count the number of roles a user is assigned to using FME and the REST API?

  • 30 November 2022
  • 1 reply

Badge +2

Hi there, I am trying to use FME to automate some user management for FME Server. Specifically I would like to schedule a workspace to remove any Azure users that are not members of a role. I have worked out how to list the users and get their roles, but I can't work out how to go from this json array: ["user:admin","fmeadmin","fmesuperuser"] to the integer value 2.


Can anyone please help me drop the "user:..." part from the array and count the number of items that are left over?





Best answer by mgg_beca 30 November 2022, 22:02

View original

1 reply

Badge +2

Nevermind, I adapted the answer from here:


changing it to: jn:size(fme:get-json-attribute("user_roles_json"))


Then I can just subtract 1 from the value to remove the "user:..." part which is always present.


Easy. Thanks @Takashi Iijima​