Rello / analytics

Analytics - Open source data warehouse and reporting for Nextcloud
GNU Affero General Public License v3.0
116 stars 32 forks source link

incorrect API error message #371

Closed C11235 closed 11 months ago

C11235 commented 12 months ago

Hi, I tried to use the REST API as suggested in the documentation with the CURL command and the URL corresponding to the REST API string provided in the nextcloud analytics web interface after adding a local dataset.

curl -u user:password -d '{"data":[{"dimension1": "x", "dimension2": "x", "value": "1"}]}' -X POST -H "Content-Type: application/json" https://***/apps/analytics/api/3.0/data/1/add

However, this results in the error {"success":false,"error":{"code":9002,"message":"Report does not allow data maintenance"}}, which I am not able to fix using existing user documentation. My goal was to create a local database on the nextcloud instance that is updated via the REST API. This might either be a bug or me misinterpreting the user documentation. Please help me. Thank you!

Rello commented 12 months ago

Hi, thank you for the issue report. I will check

Rello commented 11 months ago

Hello, I just checked and everything is working. Please consider that you can only add data to internal datasets. So you need to use the id of the dataset - not the report. You can get the ID from the URL of the dataset maintenance or in the report if you go to "Data"->"REST API" in the sidebar.

please let me know if this is working...

C11235 commented 11 months ago

Thank you!

I'm sorry, I checked again, it is indeed working.

However, I think there is a bug concerning the returned error message. My mistake was, that I had two users A and B with two different internal data sets, I accidentally tried to access the dataset of user A with the credentials of user B. I didn't spot it at first due to this error message posted earlier. It might be more convenient if in this scenario instead an error message such as "This dataset does not exist for this user" is returned.

Rello commented 11 months ago

Hello, I found an issue with the API to show incorrect messages in some constellations. it will now return a "error":{"code":9003,"message":"Unknown or unauthorized report or dataset"}

C11235 commented 11 months ago

Thank you!