How do you call backend-method from frontend?

I want to get the options of B-select-field from the Grafana backend.

for example (unverified) in frontend:

  const onChangeAFieldOptions = async() => {
    const res = ????????; // get the options from Grafana backend method which is written in Golang
    setOptionsBFieldSelect(res.data);
  }

and in backend:

  func GetOptionsBFieldSelect(aOptions string) (res []string) {
      // ~~~~~~~~~
  }

“Plugin protocol” in the Grafana docs say " The plugin protocol is built on gRPC", so I can probably call method through that, but how would I write it?

Also, is there a wrapper to help call backend, in the Grafana Toolkit?

Does anyone know this topic?
Even if the gRPC server code is prepared in the backend plugin, I don’t know if the Grafana server will handle it, so I have no plans to make this way :frowning:

I got it
use “props.datasource.getResource” in front-end and implement “CallResourceHandler” to back-end

More detailed: How to add a resource handler for your data source

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