How to get user name from credentials of a registered service using python API

166
2
01-30-2023 05:07 PM
ChrisBeaudette
Occasional Contributor

We have dozens of feature services, image services and map services in our portal that are registered with user credentials.  When viewing the Settings > [Layer_Type] > Credentials > Username, it doesn't always show the user that the layer was registered with, and sometimes is blank, so it's not a reliable way to see which user the layer was registered with.  (That may be by design, but regardless it doesn't present the info I'm looking for). If you view the layer in the Admin Assistant, it doesn't have the credentials as part of the Description in the item's JSON.  I was hoping to be able to get at the info with the python API if possible by querying the item details.  if it's not viewable in the admin assistant then I'm skeptical that it will be available by the python API, but I'd like to confirm.  I don't need the password, just the username.  If it's not possible with the pyhon API then I'd be interested in any other way to get that information.

0 Kudos
2 Replies
TonyContreras_Frisco_TX
Occasional Contributor II

Can you please clarify what you are looking for? Is it the Portal user that owns content? If so, are you looking at a webmap's layers and hoping to get the owner of the service that each layer is part of? Or are you talking about the user connecting to the data source in a service(for features/imagery in an enterprise database)? An image would be helpful.

0 Kudos
ChrisBeaudette
Occasional Contributor

Not looking for item owner (that's pretty straightforward with the python API), looking for registered user when services that are registered with credentials, i.e. the Settings > [Layer_Type] > Credentials > Username for a given portal item.

Found a solution here.

0 Kudos