Bokeh server - how to act like an API server and return JSON response

I have a working Bokeh server running a nice dashboard on an AWS EC2 instance. Everything is working fine, the UI is slick and highly responsive. However, an end user of the dashboard threw me a curveball and asked me to add basic API support, i.e. optionally supply a subset of our data in plain JSON format.

So by default the dashboard will function as normal but if the user provides some URL parameter on session start then I want override the standard bokeh server response template and simply return some data in JSON format for ingestion by some other consumer.

I would rather not implement a whole new listener/Tornado service for this if I can avoid it.

TLDR - Is it possible to override the standard Bokeh server response template and return plain text JSON instead?


The short answer is “no”, there is nothing built in that would afford that kind of interaction. The longer answer is that you can embed the Bokeh server machinery as a library, so in that case you could override the usual routes with custom ones that do whatever you want. It also sounds like you don’t want to do that, however I don’t have any other suggestions to offer.

Understood, thanks Bryan.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.