Fetch Data from Matomo API not working, either CORS errors or "function not found in module API"

68 Views Asked by At

I’m trying to fetch data from the matomo API. I tried via React, I always get error 500 (strict-origin-when-cross-origin). So I tried using a proxy (cors-anywhere), still doesn’t work. With another proxy (cors.sh) I am getting 429- too many requests. I guess with a website running in the browser that might not work requesting the matomo API?

With curl in the command line (Linux Distribution for Windows), I couldn’t reproduce the error, instead I am getting that the function cannot be found in the module API.

curl -X GET ‘https://support.tib.eu/piwik/index.php?idSite=29&rec=1&period=day&date=today&format=JSON&module=API&action=UsersFlow.getUsersFlowPretty&token_auth=…’

    <div class="header">
            <h1>An error occurred</h1>
    </div>

    <div class="content"><h2>Action &#039;UsersFlow.getUsersFlowPretty&#039; not found in the module &#039;API&#039;</h2><p><a href="javascript:window.history.back();">Go Back</a> | <a href="index.php">Go to Matomo</a></p>  <ul>
                        <li><a rel="noreferrer noopener" target="_blank" href="https://matomo.org">Matomo.org homepage</a></li>
                        <li><a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/">Frequently Asked Questions</a></li>
                        <li><a rel="noreferrer noopener" target="_blank" href="https://matomo.org/docs/">User Guides</a></li>
                        <li><a rel="noreferrer noopener" target="_blank" href="https://forum.matomo.org/">Matomo Forums</a></li>
                        <li><a rel="noreferrer noopener" target="_blank" href="https://matomo.org/support/?pk_campaign=App_AnErrorOccured&pk_source=Matomo_App&pk_medium=ProfessionalServicesLink">Professional Support for Matomo</a></li>
                        </ul>    </div>

<div class="footer">
    <a href="index.php">&laquo; Back to Matomo</a>
</div>

Could it be that the version might be a problem? As far as I know, currently the version 4.16 is installed and the docs show for version 5.0. Do you know what might be the issue? Or could it be, that my token is not authorized to request this kind of data?

I followed the docs of matomo https://developer.matomo.org/api-reference/tracking-api https://matomo.org/guide/apis/tracking-api/

tldr: I tried requesting the matomo API to fetch data, it could not be returned due to cors errors in React. In the command line using curl, I got the answer that the specific function I want to call can't be found in the module API.

0

There are 0 best solutions below