Send dashboard report using HTTP

Good morning. I am contacting you to see if you can solve the following problem.

I have followed the instructions in this link

Dashboard Actions | Losant Documentation

to be able to download a snapshot of a dashboard at any time. Since there is no option to do this from the Losant API node in a workflow, I have tried to do this using the HTTP node by making an HTTP POST request. The problem is that, using both Losant and Postman workflows, I always get the same error:

image

My request has the following form, which is identical to the one in the example:

I have tried changing parameters like mail, timestamp and timezone, but the error is still the same. I have also seen the following link:

https://docs.losant.com/rest-api/schemas/#dashboard-send-report

But I have not been able to get anything clear.

Any idea why the request is not working? I got the TOKEN API from here:

image

and it has all permissions and doesn’t expire, so that’s not it. In the HTTP petition node i added “Bearer” before the token.

Thanks, best regards.

Hello again. I just realized that I had not set the Content-Type to application/json. However, now Losant’s response is a 403 Forbidden error, and I don’t know what could be going wrong:

Thanks, best regards.

As far as your first issue, you are correct; you needed to set the “Content-Type” header to “application/json”.

As for the second issue, the “Dashboard: Send Report” endpoint is not scoped to an application (because that endpoint works both for dashboards scoped to an application and dashboards that span multiple applications), which is why you are getting a permissions error when trying to use that token.

Instead, you can use a user token to authenticate the request. Those tokens provide access to any resource you have as a user - essentially the same permissions you have when viewing the web interface. For that reason, I strongly recommend you take advantage of the token permissions feature and only provide permissions for the “Dashboard: Send Report” endpoint.

Also, FYI, I did file a feature request to create an “Application Dashboard: Send Report” API endpoint so that you can make that call using a Losant API Node as you originally tried - that is, assuming the dashboard in question is scoped to a single application and is not a cross-application dashboard.

Hi Dylan, thank you very much for your reply. That was indeed the problem. With the right token, I have now been able to do the query.

Thank you for your attention, best regards.