Retrieve the select fields

Hi,
I have been using Panel recently to build a simple app and I was wondering if there was a clean way to retrieve select fields that are used in the app.
If not, I was wondering how to cleanly add this api inside the panel app so that I do not have to spin up a flask app for this purpose. Thank you very much and have a good day

1 Like

Welcome @Axeldnahcram! Would love to help you but I’m not entirely sure I know what you mean by “select fields”, can you clarify?

@philippjfr it is a simple select field


like this one. The idea would be to retrieve the different fields like ALL,SUP,HYP,… using a simple api if that makes sense.

If you’ve got a select widget the fields can be set and updated by setting:

widget.options

Is that what you mean? I guess I’m just a bit confused because you would have had to set options on the object for them to be populated. Maybe with a bit more context, e.g. some or all of the code you’re using, I could help better.

I am sorry if I was not clear.
I have already configured and set the options inside the code. What I am trying to do is to be able to retrieve those fields by an external URL request. Like query
http://0.0.0.0:5006/dashboard/filter/suppliers
which would yield the results

{ECM, HYP, PRX, SUP, ALL}

I do not think this is directly implemented inside panel, so I just would like to know if there is a clean way to add a route to a panel server to deliver those type of JSON.

Panel can serve REST Apis. Unfortunately I cannot find any official documentation. But there is an example here Allow serving REST APIs as part of panel serve by philippjfr · Pull Request #1164 · holoviz/panel (github.com) and here HoloViz Blog.

The official Tranquilizer docs are here ContinuumIO/tranquilizer: Put your functions to REST (github.com)

Okay this is awesome. That is exactly what I needed. Thanks

1 Like