• Resolved tovbar

    (@tovbar)


    Hello,
    I’ve been facing an issue with the REST API endpoint of the plugin:
    /wp-json/koko-analytics/v1/stats?start_date=2020-01-02&end_date=2020-12-31 always says error 401.

    I tried to give a subscriber the necessary capability “view_koko_analytics” but it didn’t help.

    Here is a screenshot: https://pasteboard.co/JIpKrA4.png.

    Please guide me how to use this rest API.
    Thank you very much,
    appreciate it and your wonderful job,
    Bar

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hello Bar,

    How are you authenticating yourself in the request to the REST API?

    If you’re not sure, can you share the complete code you are using for initiating the HTTP request?

    Thread Starter tovbar

    (@tovbar)

    I was actually testing on the browser and also on the postman. I didn’t find any guide for the rest, so I don’t know what authentication should I use for the request, I tried Basic Auth.
    Please guide me in the right direction.

    https://pasteboard.co/JIGbnNu.png

    Thanks!

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hello @tovbar,

    I’m afraid this is not really specific to Koko Analytics so I can only be of limited help to you, but anyone with some knowledge on the REST API should be able to help you figure this out.

    For example, you could install the WP Basic Auth plugin and then add the Authorization header to your Postman request. There are some examples in the plugin’s README on GitHub.

    
    curl --user admin:password https://wordpressmu-499857-1628488.cloudwaysapps.com/wp-json/koko-analytics/v1/stats?start_date=2020-01-01&end_date=2021-12-31
    

    I hope that helps. Good luck!

    Thread Starter tovbar

    (@tovbar)

    Thanks Danny!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with the REST API endpoint’ is closed to new replies.