Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubt how to get Dashboard data #190

Open
axnsantana opened this issue May 31, 2024 · 4 comments
Open

Doubt how to get Dashboard data #190

axnsantana opened this issue May 31, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@axnsantana
Copy link

Hi,

first thanks a lot for the tool, really appreciate.

I am looking at the Dashboard snippets and I do not understand what are the steps to get the same data (time series) I see in the Micro UI.
I can retrieve the Dashboard, its properties, cubes, etc...

I was able to extract the data from Reports (launching instances and so on), but had no success with the Dashboard.

Probably I am missing how Micro works.

Would really appreciate if someone could help me with that.
Thanks a lot.

@axnsantana
Copy link
Author

An additional detail, I am able to get the data using the API directly with this endpoint

@hustontrevor
Copy link

Not all of the endpoints have been implemented in mstrio-py. Many times you may need to dig through the .py files to see if an endpoint is used then go back to the API-docs page to look at the schema of the result so you know how to deal with the response. Though, even those schema are not fully documented, so then you've got to step through a debugger.

Like list_dashboards() ultimately calls return connection.post(endpoint='/api/metadataSearches/results', ...

But you can access the REST endpoints from the same Connection class you've already instantiated. That makes it a bit simpler to hop back and forth.

One of mine for example:

self.mstr_conn = Connection(base_url=self.base_url
                            , username=self.username
                            , password=self.password
                            , ssl_verify=False)

    def getSubPrompts(self, project_id,subscriptionId):
        headers = {'X-MSTR-ProjectID':project_id}
        URL = f"/api/subscriptions/{subscriptionId}/prompts"
        rspns = self.mstr_conn.get(endpoint=URL, headers=headers)

        prompts = rspns.json()["prompts"] if rspns.ok else []
        if not rspns.ok:
            print(URL)
            print(f"HTTP {rspns.status_code} - {rspns.reason}, Message {rspns.text}")            
        return prompts

@axnsantana
Copy link
Author

axnsantana commented May 31, 2024

Thanks for the answer @hustontrevor.
Yes, by the end I extracted the data using the endpoint and the connection from mstrio-py.
The JSON schema it returned is a bit complex but I was able to understand and transform it into a pandas dataframe.

@apiotrowskiMicroStrategy
Copy link
Contributor

Hi @axnsantana , @hustontrevor

If you feel that the workaround you found should be resolved directly via mstrio-py functionalities, please request an Enhancement Request via our MSTR TechSupport and provide a CS id here, for reference.

With it, we will be able to properly plan and estimate for required changes.

@apiotrowskiMicroStrategy apiotrowskiMicroStrategy added the enhancement New feature or request label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants