shaystack icon indicating copy to clipboard operation
shaystack copied to clipboard

CSV by Default in content negotiation

Open spillz-dxb opened this issue 1 year ago • 6 comments

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):

  • OS: Docker
  • Browser :Edge

Additional context Add any other context about the problem here.

spillz-dxb avatar Sep 27 '24 03:09 spillz-dxb

What is the exact value of Accept header ?

pprados avatar Sep 27 '24 12:09 pprados

Normaly, it's managed. See here

pprados avatar Sep 27 '24 12:09 pprados

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 avatar Sep 27 '24 12:09 spillz-dxb

Please note i am using grafana and shaystack in docker.

spillz-dxb avatar Sep 27 '24 12:09 spillz-dxb

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

pprados avatar Sep 27 '24 13:09 pprados

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.

spillz-dxb avatar Sep 27 '24 14:09 spillz-dxb