2

On the Azure API management developer portal, there is a "Try it" feature to test api request in your browser.

The try it button:

The try it button

The test page

Is it possible to disable/remove this feature? I don't want developers to be able to post test data inside our production environment.

Justin Lessard
  • 10,804
  • 5
  • 49
  • 61

1 Answers1

2

I found a way to hide the try it button. This doesn't completely disable the feature, but makes it hidden for the user.

  1. Go to the Developer portal logged in as an admin.

  2. Click on the Edit icon on the top right

Edit icon

  1. Select Template => Operation.

  2. This should open a markup window. Look for the try it button. It should look like this

<a class="btn btn-primary" href="{{consoleUrl}}" id="btnOpenConsole" role="button">
    Try it
</a>
  1. Either remove the tag entirely or wrap it in a if/unless. Azure apim uses the DotLiquid language for its templates. I ended up doing this.

{% assign apiNamePrefix = api.name | slice: 0, 4 %}
{% if apiNamePrefix == 'TEST' %}
<a class="btn btn-primary" href="{{consoleUrl}}" id="btnOpenConsole" role="button">
    Try it
</a>
{% endif %}
  1. Save your changes. Then Publish.
Justin Lessard
  • 10,804
  • 5
  • 49
  • 61
  • I think this is for old portal, do you have any idea how we can hide Try It button on new APIM portal? – Vikash Feb 15 '22 at 07:16