Grist REST API ... is not valid JSON

Hello I apologize for stupidity, I have never worked with REST API.
Hello i try to connect self-hosted Grist with report software GET data from REST API
I receive a response from the server and at the beginning of the answer we have comments:

// 20220824184150

The validator in the program swears
Unexpected token '/', "// 2022082"... is not valid JSON

Try to query in
Same results.

How can this be overcome?

Those comment lines don’t look good, and yes can’t be included in strict json. I don’t think they are coming from Grist though. For example see this json output coming directly from a public document

What tool are you using to collect the response from the server?

Hello @paul-gristthanks for the answer
I’m testing Build JavaScript Reports | A JavaScript Reporting Tool for Web Apps | ActiveReportsJS
With test data it turns out, it is impossible to make a report from Grist.

Data processing error: Unable to load data from "": Failed to fetch..

I’d guess that tool is trying to load from Grist directly from javascript in the browser; we don’t permit that because it could allow a third-party website to access your Grist data without you realizing it. It might be reasonable to allow it for public documents though, but I presume the actual document you have is not public.

It could be a nice feature for self-hosted Grist to add a list of sites that Grist should trust. Grist could then set a header on api results that would direct browsers to allow cross-site access to the results.

1 Like

I think it is. I tried to take it from a text JSON file dataset:
All work fine.

Why then do we need a REST API in Grist and Authentication?
What if I want to use Grist as a Headless CMS for a website or mobile app? Or, as in my case, the data source for reports?

I’m sorry, getting data works in other programs except ActiveReportsJS @paul-grist 100% right