Postman4J Models
This projects provides a set of models with that is easy to use Java classes for further work with Postman collections from Java code. Required Java 11+.
Installation
gradle
implementation group: 'dev.jora.postman4j', name: 'postman4j-models', version: '0.0.5-alpha'
Use Postman Collection models
Create a new Postman collection Java object using the PostmanCollection.java class and fill it with the data you need:
import dev.jora.postman4j.models.PostmanCollection;
import dev.jora.postman4j.models.Information;
import dev.jora.postman4j.models.SchemaVersion;
//...
PostmanCollection postmanCollection = new PostmanCollection();
Information information = new Information();
information.setName("My Collection");
information.setSchema(schemaVersion.getSchemaUrl());
postmanCollection.setInfo(information);
Parse and serialize Postman collections
Serialize and parse Postman collection from a JSON string using ConverterUtils:
import dev.jora.postman4j.utils.ConverterUtils;
import dev.jora.postman4j.models.PostmanCollection;
// ...
PostmanCollection postmanCollection = ConverterUtils.fromJsonString(jsonString);
String jsonString = ConverterUtils.toJsonString(postmanCollection);
Last updated on