Working with testDatasource in DataSource class for plugin options

Hi, all!
I need to generate a new id and send back that id generated to the backend in testDatasource.

After sending id to the backend, I need to save that id to the instanceSettings.

Is there any way I can implement this feature?

Just to clarify, you want to:

  1. Generate an id in the testDatasource
  2. Pass the id to the backend plugin, which in turn makes the request (with the id) to the third-party API
  3. If the request was successful, you want to store the generated id

Do you generate a new id everytime you call testDatasource? If so, why do you need to store it?

Are you implementing an OAuth flow? In that case, have you looked at the tokenAuth/jwtTokenAuth config?

No, I don’t need to generate id everytime.
Just create an id when the testDatasource is called and save it to the backend/