How to get controllers and status of a canisterId?

Screenshot 2022-04-04 at 12.58.23 PM
In canlista, we can see canister running status and controllers.

Using javascript/agent how to get controllers and running status of a provided canisterId?

If not, how to get this information? motoko/rust ?

using dfx we can get by
dfx canister --network ic info ivcos-eqaaa-aaaab-qablq-cai

Controllers: hgfyw-myaaa-aaaab-qaaoa-cai
Module hash: 0x2d8060fe316775976ad0a33975e846e98b649536be51c8bcf33a7c61806041c6

How to achieve same by JS?

1 Like

I tried this last week :point_right: How to make IC Management API canister_status call with @dfinity/agent? - #2 by peterparker


@peterparker Your approach doesn’t seems to give controllers info for anonymous identity.

But, by using nns/lifeline - rno2w-sqaaa-aaaaa-aaacq-cai canister and method canister_status I am able get Canister’s controllers information as an error

any other cleaner approach to get controllers and canister running, module hash status using js?

At the end of the day I deferred the work to the backend canister in a custom function so that’s an alternative. You implement the function in your canister and from js you call your own custom function.

You should check out the discussion here