{"id":15062788,"url":"https://github.com/jairmilanes/postman-sdk","last_synced_at":"2026-04-02T11:21:27.355Z","repository":{"id":49406507,"uuid":"123773231","full_name":"jairmilanes/postman-sdk","owner":"jairmilanes","description":"A simple Postman SDK to interact with the Postman REST Api","archived":false,"fork":false,"pushed_at":"2018-11-02T15:01:33.000Z","size":1127,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T04:43:35.717Z","etag":null,"topics":["postman","postman-api","postman-apps","postman-collection","postman-example","postman-sdk"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jairmilanes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-04T09:13:17.000Z","updated_at":"2023-09-01T14:55:14.000Z","dependencies_parsed_at":"2022-08-29T11:31:43.825Z","dependency_job_id":null,"html_url":"https://github.com/jairmilanes/postman-sdk","commit_stats":null,"previous_names":["layoutzweb/postman-sdk"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jairmilanes/postman-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jairmilanes%2Fpostman-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jairmilanes%2Fpostman-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jairmilanes%2Fpostman-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jairmilanes%2Fpostman-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jairmilanes","download_url":"https://codeload.github.com/jairmilanes/postman-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jairmilanes%2Fpostman-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31305274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T09:48:21.550Z","status":"ssl_error","status_checked_at":"2026-04-02T09:48:19.196Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postman","postman-api","postman-apps","postman-collection","postman-example","postman-sdk"],"created_at":"2024-09-24T23:46:35.989Z","updated_at":"2026-04-02T11:21:27.338Z","avatar_url":"https://github.com/jairmilanes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Postman Unofficial SDK - By Jair Milanes](https://github.com/layoutzweb/postman-sdk/raw/master/media/postman-logo.png 'Postman SDK')\n\nAn unoficial Postman SDK to create and manage collections \u0026 environments localy and in the cloud.\n\n![Travis](https://img.shields.io/travis/layoutzweb/postman-sdk.svg) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/73cc03084b25454ebaa1cd2b8f101669)](https://www.codacy.com/app/layoutzweb/postman-sdk?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=layoutzweb/postman-sdk\u0026utm_campaign=Badge_Grade) [![npm](https://img.shields.io/npm/v/postman-sdk.svg)](https://github.com/layoutzweb/postman-sdk) [![license](https://img.shields.io/github/license/layoutzweb/postman-sdk.svg)](https://github.com/layoutzweb/postman-sdk)\n\n# [Why a Postman SDK?](#why-postman)\n\nPostman is well known for providing a great tool to perform request's against any api server, but if you look deeper there are other nice features to it, that maybe you are overlooking.\n\nOne of them is a Collection. A Collection holds groups of pre-configured requests, that you can access and use it with just a couple of clicks and the best part of this feature is that collections can be shared!\n\nBut that is not all, a Collection can also be used to export full featured documentation pages for your api's, that users can visit and interact with by checking request properties, parameter descriptions \u0026 response examples.\n\nSooo I created this SDK to help me automate the generation of collections and it's proper documentation page in a Express server middleware, witch you can find here (link available soon).\n\nIf you find it useful it's your's to use! Cheers!\n\n# [How to use it](#how-to-use-it)\n\nThe Postman Sdk provides 3 main classes to help you create and manage your collections, EnvironmentManager, CollectionsManager and the Client, but first things first, if you plan on using the client to interact with the Postman Api, start by installing the package:\n\n```\nnpm install postman-sdk --save\n```\n\nNext, have a environment variable set with your Postman Api Key:\n\n```apacheconfig\nPOSTMAN_API_KEY=[YOUR KEY HERE]  \n```\n\nThe api key can also be passed to the Client constructor as you will see below, but setting it as an environment variable is highly recommended.\n\nNow for each helper class:\n\n## EnvironmentManager\n\nThe EnvironmentManager creates a new Environment and allows you to manage it's variables just like managing collections items and events.\n\u003cbr\u003e\u003cbr\u003e\n\n```javascript\nconst envrionments = []\n// You can create environments to handle specific variables that change between environments\nconst dev = new EnvironmentManager('development') // you can give any name\ndev.add({\n\tkey: 'HOST',\n\tvalue: 'dev.myhost.com',\n\ttype: 'string',\n\tenabled: true\n})\n// Passing properties as arguments also works\ndev.add('PROTOCOL', 'http', 'string', true)\n\n// You can give any name\nconst staging = new EnvironmentManager('staging')\nstaging.add({\n\tkey: 'HOST',\n\tvalue: 'staging.myhost.com',\n\ttype: 'string',\n\tenabled: true\n})\n// Passing properties as arguments also works\nstaging.add('PROTOCOL', 'http', 'string', true)\n\n// Lets added here for now so we can use in the examples bellow\nenvrionments.concat([dev, staging])\n```\n\n## CollectionManager\n\nThe CollectionManager creates a new collection and allows you to manage it's items \u0026 events by providing stray forward methods to add, find \u0026 remove entries.\n\n```javascript\nconst collection = new CollectionManager('my-collection', '1.0.0')\ncollection.item.add('test-endpoint', {\n\tpath: '/test-endpoint',\n\tmethod: 'GET',\n\tprotocol: 'http',\n\thost: 'localhost',\n\tquery: 'test=1'\n})\ncollection.item.addFolder('First Folder')\ncollection.item.addToFolder('First Folder', 'test-endpoint-2', {\n\tpath: '/test-endpoint-2',\n\tmethod: 'DELETE',\n\tprotocol: 'http',\n\thost: 'localhost'\n})\n```\n\n## Client\n\nThe Client is a simple Promise based client to communicate with the Postman REST api and get/save/update/delete your collections, environments, mocks, monitors \u0026 the user profile in the cloud, from there you can share and or publish your api documentation.\n\n```javascript\n// Provide the api key only if you have no set it as a env variable\nconst environmentClient = new Client('environments', '[API_KEY]')\n// We can post each environment we created ealier:\nenvrionments.forEach(env =\u003e {\n    client.post(env.toJSON())\n        .then(response =\u003e console.log(response)\n        .catch(error =\u003e console.error(error))\n})\n\nconst collectionClient = new Client('collections', '[APY_KEY]')\n// Like the environment, we can post or collection we created in the example above:\ncollectionClient.post(collection.toJSON())\n.then(response =\u003e console.log(response))\n.match(error =\u003e console.log(error))\n```\n\n# [Advanced Usage](#advanced-usage)\n\nThere is more you can do with the CollectionManager if you want to enhance your collections and documentation even more:\nUse helper methods to programaticaly generate, update or remove collection items:\n\n### Easily find \u0026 remove items\n\n```\n// You can find items inside collections\nconst item = collection.item.find('test-endpoint-2')\nconsole.log(item)\n\n// Remove items from collections\ncollection.item.remove('test-endpoint')\n\n// Check if an item exists\nconst exists = collection.item.has('test-endpoint')\n// Will log 'false'\nconsole.log(exists)\n\n// Find an item with a custom function\nconst item =\n```\n\n### Add custom headers\n\n```\nconst item = collection.find('test-endpoint-2')\nitem.request.headers.add('Content-type', 'application/json')\n\n// You can also use any methods available for the item it self\nitem.request.headers.find('Content-type')\nitem.request.headers.has('Content-type')\nitem.request.headers.findIndex('Content-type')\nitem.request.headers.remove('Content-type')\n```\n\n### Add events\n\nEvents can be added to the collection level or the item level. This means that if you add it at the collection level or the item level. If added to the collection, any request item on that collection can trigger, otherwise only the item you add to it will trigger.\n\n```\ncollection.event.add({\nname: 'My Script',\nlisten: 'prerequest', // This is the default value and could be omitted\ndisabled: false,\ntype: 'text/javascript', // Also the default value and could be omitted\nexec: ['console.log('MY LOG!')', 'ANY JAVASCRIPT SCRIPT'], // Provide either the exec or source property, never both, only added here for demonstration, see below for source example.\n})\n\n// Lets add one to an item:\nconst item = collection.find('test-endpoint-2')\nitem.event.add({\nname: 'My Script',\nlisten: 'prerequest', // This is the default value and could be omitted\ndisabled: false,\ntype: 'text/javascript', // Also the default value and could be omitted\nsource: 'http://myhost.com/myscript.js'\n})\n\n// You can also use any methods available for the item it self\nitem.event.find('Content-type')\nitem.event.has('Content-type')\nitem.event.findIndex('Content-type')\nitem.event.remove('Content-type')\n```\n\n## [Full Documentation](#full-docs)\n\nYou can also find a more detailed documentation with each method and class available here:\n[Postman SDK Documentaion Page](https://layoutzweb.github.io/postman-sdk/postman-sdk/1.3.2/Client.html)\n\n## [Official Api Docs](#official-docs)\n\nUsed as reference for the development of this SDK.\n[Official Api Docs](https://docs.api.getpostman.com)\n\n# [Tests](#tests)\n\nAssuming you have cloned this repo and have dependencies installed by running `npm install`, run:\n\n```javascript\nnpm run jest  \n```\n\n# [Contributions](#Collaboration)\n\nIf you like the SDK and found bug's, or have suggestions on how we could improve it please submit your pull requests. I will consider all suggestions. One rule, make sure you have tests included! Cheers!\n\n# [License](#license)\n\n```\nMIT License  \n\nPermission is hereby granted, free of charge, to any person obtaining a copy  \nof this software and associated documentation files (the \"Software\"), to deal  \nin the Software without restriction, including without limitation the rights  \nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell  \ncopies of the Software, and to permit persons to whom the Software is  \nfurnished to do so, subject to the following conditions:  \n\nThe above copyright notice and this permission notice shall be included in all  \ncopies or substantial portions of the Software.  \n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  \nSOFTWARE.  \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjairmilanes%2Fpostman-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjairmilanes%2Fpostman-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjairmilanes%2Fpostman-sdk/lists"}