如何在 Azure API 管理开发人员门户中禁用试用功能?
How to disable the try it function in the Azure API management developer portal?
在 Azure API 管理开发人员门户上,有一个 "Try it" 功能可以在您的浏览器中测试 api 请求。
试用按钮:
是否可以disable/remove此功能?我不希望开发人员能够 post 在我们的生产环境中测试数据。
我找到了隐藏试用按钮的方法。这不会完全禁用该功能,但会使其对用户隐藏。
以管理员身份登录开发者门户。
点击右上角的编辑图标
Select模板=>操作。
这应该会打开一个标记 window。寻找试用按钮。它应该看起来像这样
<a class="btn btn-primary" href="{{consoleUrl}}" id="btnOpenConsole" role="button">
Try it
</a>
- 要么完全删除标签,要么将其包装在
if
/unless
中。 Azure apim 使用 the DotLiquid language 作为其模板。我最终这样做了。
{% 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 %}
- 保存您的更改。然后发布。
在 Azure API 管理开发人员门户上,有一个 "Try it" 功能可以在您的浏览器中测试 api 请求。
试用按钮:
是否可以disable/remove此功能?我不希望开发人员能够 post 在我们的生产环境中测试数据。
我找到了隐藏试用按钮的方法。这不会完全禁用该功能,但会使其对用户隐藏。
以管理员身份登录开发者门户。
点击右上角的编辑图标
Select模板=>操作。
这应该会打开一个标记 window。寻找试用按钮。它应该看起来像这样
<a class="btn btn-primary" href="{{consoleUrl}}" id="btnOpenConsole" role="button">
Try it
</a>
- 要么完全删除标签,要么将其包装在
if
/unless
中。 Azure apim 使用 the DotLiquid language 作为其模板。我最终这样做了。
{% 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 %}
- 保存您的更改。然后发布。