engie-group / shaystack

Simplifying Implementation of Haystack
BSD 2-Clause "Simplified" License
24 stars 8 forks source link

CSV by Default in content negotiation #25

Open spillz-dxb opened 1 month ago

spillz-dxb commented 1 month ago

Describe the bug The Http server api , by default serves data in csv format , if the accept headers arent used . Is there a way to change it to json or zinc by default. The grafana data source fails because of this as there is no way to add http headers in the data source.

To Reproduce Steps to reproduce the behavior: Open browser and use get method for http://localhost:3000/haystack/ returns a CSV file instead of in browser zinc or json for other implementations .

Expected behavior By default a zinc or json format is expected , or means to change the default to different formats in shaystack

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

pprados commented 1 month ago

What is the exact value of Accept header ?

pprados commented 1 month ago

Normaly, it's managed. See here

spillz-dxb commented 1 month ago

Hi Philippe, Thannks for responding . There is no issue when i use postman to call the OPS with Accept Header , text/zinc and application/json. the issue happens when the url is called from a standard web browser , the default state is csv and it downloads a csv file as in the screen shot .

Screenshot 2024-09-27 180518

The objective is to use the grafana plugin https://github.com/NeedleInAJayStack/needleinajaystack-haystack-datasource Since the integration failed i was testing it on postman and browser . Do you know of any instance of shaystack integration with grafana , that could be of help .

image Maybe i am moving away from the topic , if you feel so , i can raise another issue in both repos .

As you see the data source adds well and the ops are discovered

image

However on a simple read for filter= site . i get a 406 error . Trying to figure out where i went wrong?

image

I have added the sample dataset and able to read the data from postman.

Regards,

Sandy

spillz-dxb commented 1 month ago

Please note i am using grafana and shaystack in docker.

pprados commented 1 month ago

Read here, the default type is CSV, because it's a type everyone can use.

spillz-dxb commented 1 month ago

Thanks Philippe . this works when i changed the default to zinc and json . however im still yet to get success regarding the integration to grafana.