Complete the code to export a Postman collection as JSON.
JSON.[1](pm.collection.toJSON())The toJSON() method returns a JavaScript object representing the collection. To convert it to a JSON string for documentation or export, use stringify.
Complete the code to generate documentation for a Postman collection.
pm.collection.generateDocumentation([1])The generateDocumentation method requires an options object. Passing an empty object {} uses default settings to generate documentation.
Fix the error in the code to correctly export collection documentation as HTML.
const doc = pm.collection.generateDocumentation({ format: 'html' });
pm.environment.set('docHTML', [1]);The variable doc already contains the generated HTML string. Setting the environment variable with doc stores the HTML correctly.
Fill both blanks to create a script that saves collection documentation to a file.
const fs = require('[1]'); fs.writeFileSync('collection-doc.html', [2]);
Node.js uses the fs module to write files. The documentation content is stored in the variable doc, which should be written to the file.
Fill all three blanks to generate Markdown documentation and save it to a variable.
const [1] = pm.collection.generateDocumentation({ format: '[2]' }); const markdownDoc = [3];
The variable mdDoc stores the generated Markdown documentation. The format option should be set to 'markdown'. Then assign mdDoc to markdownDoc for clarity.