Menu Close
Settings Close

Language and Page Formatting Options

Chapter 4. Publish ActiveDocs in the Developer Portal

By the end of this tutorial, you will have published your ActiveDocs in your developer portal.

Once you have added specifications to 3scale, it’s time to make it public and link it on your Developer Portal so it can be used by your API developers.

Add the following snippet to the content of any page of your Developer Portal. This must be done through the CMS of your Developer Portal. Note that SERVICE_NAME should be the system name of the service specification, pet_store in the example.

<p>Use our live documentation to learn about Echo API</p>
{% active_docs version: "2.0" services: "SERVICE_NAME" %}
{% cdn_asset /swagger-ui/2.2.10/swagger-ui.js %} {% cdn_asset /swagger-ui/2.2.10/swagger-ui.css %} {% include 'shared/swagger_ui' %}
<script type="text/javascript">
  $(function () {
    {% comment %}
      // you have access to swaggerUi.options object to customize its behaviour
      // such as setting a different docExpansion mode
      window.swaggerUi.options['docExpansion'] = 'none';
      // or even getting the swagger specification loaded from a different url
      window.swaggerUi.options['url'] = "";
    {% endcomment %}
  • You can specify only one service on one page. If you want to display multiple specifications, the best way is to do it on different pages.
  • This snippet requires jQuery, which is typically already included in the main layout of your Developer Portal. If you remove it from there, make sure you add the jQuery dependency on the page with ActiveDocs.
  • Make sure you have Liquid tags enabled on the CMS page.
  • The version used in the Liquid tag {{ '{% active_docs version: "2.0" ' }}%} should correspond to that of the Swagger spec.
  • If you would like to fetch your specification from an external source, change the JavaScript code as follows:
$(function () {
 window.swaggerUi.options['url'] = "SWAGGER_JSON_URL";

You can see an example in the snippet in on line 14. Just make sure that this line is not inside the comments block.