Reports pro endpoint not working

I’m trying to consume the reports-pro endpoint and it doesn’t work, it throws a “rest_no_route” error:

https://www.myweb.com/wp-json/mainwp/v1/pro-reports/wordpress?site_id=6&consumer_key=ck_myck&consumer_secret=cs_mycs&start_date=2023-1-01&end_date=2023-5-01&action=updated

I have added the endpoint as shown in the guide but it seems that the pro-reports one did not exist, the truth is quite strange, this is my URL: https://www.mantenimiento.web-pre.com/

@juanriverarq give us about an hour to release an update. It seems when we added the option for multiple APIs in your Dashboard we also introduced a bug causing issues.

2 Likes

Hi @dennis, Thank you very much, I was trying in a thousand ways, even installing other environments, but it still didn’t work, I consult you in this thread that is related to the subject, through the API can I rescue the PDFs of the reports? I would like to create a table on my intranet where I can retrieve the sites and the pdfs of reports apart from dates, associated with these sites.

The API won’t create a PDF report for you; it will just give you the results of the response to your call. You would need some PDF creation tool that can read the API results.

You can, however, use the API to display the report results in a table on your site.

Quick edit: Our Postman API documentation should be ready late next week or early the following and that may make things easier for you

1 Like

Thank you, do you think that with a query to the database you can retrieve the PDFs per client?

@juanriverarq As mentioned by @dennis the /Pro-reports endpoints only return the data needed to “create a report” with your own means. Such as described in this article here:

@bojan Has also informed me that the Pro Report Extension now also saves a copy of each report generated here:

So with a custom PHP script you could grab those and then do what you want with them from there. But they will still be tied to the Dates Chosen when they were generated. If you want custom dates you will need custom code & the MainWP API to pull that off as “Reports” are generated “on the fly”.

1 Like

@kwcjr Thank you very much, with this I can work and achieve what I want.

2 Likes

@juanriverarq

We’ve just released Pro Reports v4.1.1, which includes the fix for the REST API authentication process, and we’ve added a new feature that offers options to customize titles, subtitles, and table headings.

Thanks again for bringing this to our attention.

2 Likes

@bojan @kwcjr Hello, good evening, I appreciate all your help so far, I have not been able to achieve what I want, I would like to be able to retrieve a table with the list of sites and their respective pdfs, I saw that a copy of the PDFs is saved in the upload folder However, I don’t see a possible way to recover them as I wish, do you have a snippet script or sql query where I can retrieve that information?

If you need to accomplish this for a small number of websites, you could create a separate report for each of your sites, and then rename the PDF file.

That should make it easier for you to grab and organize the files according to their respective sites.
image

@bojan I have about 30 websites, the reason for this is because I have an Intranet where I provide all the service information to my clients, among those maintenance and I want him to be able to see his sites in a table and also the maintenance reports in PDF that It is done every month, that all this is automatic

Something like that would have to be custom-built.

Unfortunately, there is no query that can return a list of sites and their respective PDFs.

One solution, as explained earlier, you would need to fetch the data via REST API, but you would then need a tool that would create the actual PDF with that data.

Another solution would be to create a report for each of the 30 sites, and rename the PDF file as explained in the previous post. But again, you would need a tool or custom code that would fetch the PDFs, and a list of sites and make it presentable to your client.

You can find our MainWP Developer Resources at https://mainwp.dev/

Forgot to mention that the “Report PDF filename” field accept tokens. So instead of having a separate report for each site, you can use a [client.site.name] token in that field.
image

However, the filename will not contain a date.

To achieve that, you can use use this code snippet @kwcjr made, which will add the Site name to the PDF file and also append a date: Add site name to pdf report file. · GitHub
image

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.