Two way datasource plugin communication with front-end

currently I have a front-end panel that communicates with my external API using some basic GET and POST endpoints (all the requests are for now done inside panel).
I am wondering if it’s possible to create a datasource backend plugin that will be responsible for external API communication? I’ve already seen some examples with getting external API data with datasource plugin but is it possible to also POST some data with it? How it should be done?

Thank you for help :slight_smile:
Best regards

Hi @adamhowaniec

The problem you will face with a datasource plugin for this is that panels don’t usually request data to datasources but instead datasources provide data to panels. It is not a two-direction communication.

The only way panels could request new data is by, for example, altering dashboard variables or changing the timerange so the datasource is queried again.

Maybe what you are looking to write is an app instead of a panel plugin. An app can bundle datasources and panels and they can also contain a full UI to display inside grafana and a backend component that you can call to make requests.