Forum Discussion

Vee's avatar
2 years ago

Getting Graph Sharing Token via REST API

Hello,

I am new member of LogicMonior.    I have created new dashboard and done about adding device graph into dashboard via API, it work!      but now, I want to generate “Widget Embedded URL” and also get “Sharing Token” via REST API, after created graph on Dashboard.     Is it possible to do that?

Thank you very much for all recommendation and comment

  • Anonymous's avatar
    Anonymous
    2 years ago

    It looks like you’re trying to post in the token. You don’t post in the token, it’ll be in the response.

    Also, add a header called “X-Version” with a value of 3. This ensures you are using API v3 (if you don’t specify it will assume v1 or v2, which might not be backward compatible with a v3 reuqest)..

    You might consider manually creating the token with the developer tools for your browser open. This will let you see on the network tab all the details of the request that are made when the UI makes the call.

  • Anonymous's avatar
    Anonymous

    Before posting, I have already created a dashboard with different timeframes

    You mean, you edited each widget to have a different default timeframe? That is what I’m suggesting. If that doesn’t work, i’m not sure what to try next.

    Do you mean that you made a different dashboard and selected a different timeframe at the top of the dashboard? That won’t work. The timeframe selected at the top of the dashboard has no impact on the configuration of the widget, which is what is used when the widget is displayed externally.

  • It looks like sharing a widget only allows you to share the widget with the default timeframe configured in the widget. Probably the easiest would be to create a dashboard with the different timeframes you want and generate a sharing token for each one.

    You might be able to generate the sharing token, reconfigure the widget to a different default timeframe, and then generate another sharing token. But i’m not sure that would work. Both tokens would probably end up pointing to the same timeframe since the timeframe is in the widget not in the token.

    Thank you very much for your quicks help,    Before posting, I have already created a dashboard with different timeframes, but I still got the same result (time-range still be 7 days)

    Anyway, I will try to do it again as your recommendation.      Thank you very much Mr. @Stuart Weenig
     

  • Before posting, I have already created a dashboard with different timeframes

    You mean, you edited each widget to have a different default timeframe? That is what I’m suggesting. If that doesn’t work, i’m not sure what to try next.

    Do you mean that you made a different dashboard and selected a different timeframe at the top of the dashboard? That won’t work. The timeframe selected at the top of the dashboard has no impact on the configuration of the widget, which is what is used when the widget is displayed externally.

    ํYes, I have created each widget to have a different default timeframe and put into dashboard, Then I create sharing widget via API as you guide me.  

  • Anonymous's avatar
    Anonymous

    That’s odd then. If you look at the dashboard and for the dashboard (at the top right) you select “Default timeframe” do the widgets all show the proper timeframe?