Document all the payloads for the requests

I WANT to ask
I want in Postman that all the payloads we have can be documented, or can we have any directory path so that we have the records of our payloads?
Does it seem possible to have
Please let me know in Postman!
thankful.

Hey @technical-physicist1 :wave:

Welcome to the Postman Community! :postman:

You could add those payloads as Examples for a request in the Collection. By adding them here, they would be displayed on the auto-generated Collection documentation for you.

On the request, you can use the View more actions menu and select Add example:

Add your alternative payload in the example:

Those can be selected in the Example dropdown and will be displayed on the documentation:

More information can be found on our Learning Center:

i do not have that add example option in this!

You’re opening the menu for the Collection or Folder, you need to do this on the Request.

I have around 500+ APIs
I have to manually add that example to this, which will be a headache.
Is there any method or library that can automatically save payloads in any file or folder?

You could utilize the Postman API to programatically add examples to your requests using this endpoint.

The request body would need to be in this format:

{
    "name": "Example - POST Request",
    "responseCode": {
        "code": 200,
        "name": "OK"
    },
    "language": "json",
    "rawDataType": null,
    "requestObject": "{\"data\":null,\"dataMode\":\"raw\",\"dataOptions\":{\"raw\":{\"language\":\"json\"}},\"headerData\":[],\"method\":\"POST\",\"queryParams\":[],\"url\":\"https://postman-echo.com/post\",\"headers\":\"\",\"rawModeData\":\"{\\n    \\\"field\\\": \\\"Value\\\"\\n}\"}"
}

The rawModeData part of the requestObject would be where you would can add the payload example body.

As you have multiple requests, you would need create the logic to get all the ids (These can be extracted from the GET Collection endpoint) and loop over them adding in the examples using the Postman API endpoint I referenced.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.