We use {{ApiEx}} to present api.php API examples. The template output should have a [try in ApiSandbox] link to Special:ApiSandbox, preloading it with the same parameters.
Same idea as T89229: API Help should generate [try in ApiSandbox] link to Special:ApiSandbox#action=params from getExamples()