I am developing a REST API. during development I have used postman (chrome extension) to use and document my API. It is a wonderful tool and I have most of my API endpoints in it. However, as we near release I would like to document this API in swagger, how would I do that? Is there a way that I can generate swagger based off of the postman export?
Asked
Active
Viewed 7.3k times
83
-
For C#/DotNet, see these two: 1.[]c# - How to generate JSON Postman Collections from a WebApi2 project using WebApi HelpPages that are suitable for import - Stack Overflow ; ; stackoverflow.com/questions/23158379/ ; ; ; 2.[]; ; X.Introducing the Azure API Apps Tools for Visual Studio 2013 - The Visual Studio Blog - Site Home - MSDN Blogs ; ; http://blogs.msdn.com/b/visualstudio/archive/2015/03/24/introducing-the-azure-api-apps-tools-for-visual-studio-2013.aspx – AnneTheAgile Dec 23 '15 at 03:46
-
You can use postman2openapi on the web: https://kevinswiber.github.io/postman2openapi/ – Arlemi Apr 07 '21 at 14:22
3 Answers
92
APIMatic API Transformer can process a Postman collection (v1 or v2) as an input format and produce Swagger 1.2 or 2.0, and now OpenAPI 3.0.0 as output.
It has its own API and a Web front-end, and also a command-line version.
![](../../users/profiles/113116.webp)
Helen
- 58,317
- 8
- 161
- 218
![](../../users/profiles/139404.webp)
MikeRalphson
- 1,751
- 1
- 12
- 13
-
8
-
-
This works like a charm when I tried to convert my postman V2.1 json to swagger 2.0. But they ask you to sign up first. – Sathish Nov 22 '19 at 10:30
-
I have signed up and they have provided me a 14 days trial period, not sure if I would be able to convert the Postman collection to Swagger post the trial period is over. – Rito Jan 25 '21 at 05:22
16
Someone posted this link (and deleted it?): http://restunited.com/
It accepts postman JSON and converts it to swagger. This seems to be what I was looking for.
![](../../users/profiles/3938000.webp)
StuBob
- 1,192
- 1
- 8
- 13
-
4RestUnited is only free if one has <=5 endpoints per API and <=3 APIs. – AnneTheAgile Dec 22 '15 at 18:35
-
The export (to postman collection or swagger spec) has no limitation. The limitation you mentioned is only for generating SDKs and documentation. – William Cheng Aug 12 '16 at 13:18
-
5
-
1I just tried to import the default postman echo collection on restunited and it wouldn't work. Maybe they haven't been keeping up to date with postman? – daraul Apr 21 '18 at 16:07
-
1
-
Not able to find the upload postman collection option, maybe they have stopped the support. – Rito Jan 19 '21 at 11:48
14
You can use https://github.com/stoplightio/api-spec-converter with code
var transformer = require('api-spec-transformer');
var postmanToSwagger = new transformer.Converter(transformer.Formats.POSTMAN, transformer.Formats.SWAGGER);
postmanToSwagger.loadFile('/path/to/your.json.postman_collection', function(err) {
if (err) {
console.log(err.stack);
return;
}
postmanToSwagger.convert('yaml')
.then(function(convertedData) {
// convertedData is swagger YAML string
console.log(convertedData);
})
.catch(function(err){
console.log(err);
});
});
![](../../users/profiles/7862478.webp)
plotnik
- 344
- 2
- 5