Tip - Export API documentation to a standalone HTML (ReDoc rendering)

This make you able (in command line shell) to provide to customers a standalone HTML file (no need to be connected to use it, except for external links of course).

Installation

Prerequesite

You need to have node.js preinstalled.

Get the redoc-cli package

npm install -g redoc-cli

then

npx redoc-cli bundle --help

Bundle a documentation from the URL

Bundle the documentation

Use the command:

redoc-cli bundle <URL of the document> --o <name of target file> --title <title of documentation>

--o or --title are not required. If --o is omitted, the name of the file will be redoc-static.html.

Example (documentation of DAM Services exposed on Wedia Portal Demo) :

If the documentation is secure, you can pass credentials within the URI:

redoc-cli bundle https://username:password@club-wed.wedia-group.com/api/rest/doc/dam/swagger.json

Bundle a documentation with a local file

First, download the OAS3 document

This a description file (a JSON or a YAML).

You can get the description file of REST Api exposed by WXM_RESTAPI plugin using the same URL to show the doc, then adding at the end of the URL, /swagger.json. Then download (use Save As in your browser) the file.

By example, to show the documentation of DAM Services exposed on Wedia Portal Demo, use https://club-wed.wedia-group.com/api/rest/doc/dam. To get the corresponding OAS3 JSon, type https://club-wed.wedia-group.com/api/rest/doc/dam/swagger.json.

Then bundle the documentation

Use the command:

--o or --title are not required. If --o is omitted, the name of the file will be redoc-static.html.

Example :

URL of documentation

Here are the URL of documentations:

legacy services

  • Endpoints: /api/json/{resource}

  • Documentation URL: /api/rest/doc/json

dam services

  • Endpoints: /api/rest/dam/{data/}{resource}

  • Documentation URL: /api/rest/doc/dam

RESTful services

  • Endpoints: /api/rest/data/{resource}

  • Documentation URL: /api/rest/doc/data

Media services

  • Endpoints: /api/rest/media/{resource}

  • Documentation URL: /api/rest/doc/media

ReDoc-cli

https://github.com/Redocly/redoc/blob/master/cli/README.md

 

Â