{"id":23889592,"url":"https://github.com/hamednn76/postman-fetch","last_synced_at":"2026-03-05T04:03:51.909Z","repository":{"id":57153151,"uuid":"191059128","full_name":"HamedNN76/postman-fetch","owner":"HamedNN76","description":"A package for fetch from your postman collection easily with name of your request","archived":false,"fork":false,"pushed_at":"2024-03-02T20:29:11.000Z","size":235,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T12:15:06.430Z","etag":null,"topics":["angular","javascript","node","postman","postman-json-collection","react","vue"],"latest_commit_sha":null,"homepage":"","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/HamedNN76.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-09T21:54:28.000Z","updated_at":"2024-03-02T20:29:15.000Z","dependencies_parsed_at":"2024-06-21T19:06:24.110Z","dependency_job_id":null,"html_url":"https://github.com/HamedNN76/postman-fetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamedNN76%2Fpostman-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamedNN76%2Fpostman-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamedNN76%2Fpostman-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamedNN76%2Fpostman-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HamedNN76","download_url":"https://codeload.github.com/HamedNN76/postman-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248167103,"owners_count":21058541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["angular","javascript","node","postman","postman-json-collection","react","vue"],"created_at":"2025-01-04T10:25:35.756Z","updated_at":"2025-10-25T11:20:10.055Z","avatar_url":"https://github.com/HamedNN76.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postman Fetch\n\nA package for fetch from your postman collection easily with name of your request.\n\n## Description\n\nIn every project there is a pain for having a full document for an application services or APIs.\nThe Postman application is a good place for testing or using our services, so we need to set headers, body or query params and etc for a service to work and also you have environment variables.\n\nBut you need to set all the parameters in code to call your services.\n\nWith this package and Postman JSON collection we can fetch our services easily with the request name that we set in postman application. \n## Installing\n\nEasily installing from npm with blow command:\n\n```\nnpm i -s postman-fetch\n```\n\n### Using the package\n\nThis package provide PostmanFetch class for handle your API requests.\n\nWe have to pass two parameters to this class:\n\n- Postman exported JSON collection (v2.1).\n- Options:\n    - variables: pass your postman environment variables as an object.\n    - headers: use global headers in all requests.\n    - debug: this flag log the important thing like request and params for development.\n\nFor example you can make fetch.js file like this:\n```\nimport PostmanFetch from 'postman-fetch';\nimport * as postmanCollection from 'path/to/postmanCollection';\n\nconst options = {\n    variables: {\n        baseURL: 'https://api.com/v1',\n        adminToken: 'A jwt token',\n        userToken: 'A jwt token',\n        ...\n    },\n    headers: {\n        \"Content-Type\": \"application/json\",\n        ...\n    },\n    debug: true //default false\n};\nconst { fetch } = new PostmanFetch(postmanCollection, options);\n\nexport default fetch;\n```\n\nFor example you have a request with \"getUsers\" name.\n\nAnd then in another file use the fetch method:\n```\nimport fetch from '/path/to/fetch.js';\n\nfetch('getUsers')\n```\nOr if you have created directory in your postman for example:\n\nadminPanel -\u003e users -\u003e getAllUsers\n\nYou can do like this:\n```\nimport fetch from '/path/to/fetch.js';\n\nfetch('adminPanel.users.getAllUsers')\n```\n\nFrom now you can fetch your request the headers, url, variables and all the thing that set in postman before.\n\nWhat if you need to change a variable in some events in your application? For example you want to save the authenticated user token in your fetch method or remove it after logout.\n\nYou can easily set your new variables with \"setVariables\" method in PostmanFetch class.\n\nSo we have some changes in fetch.js file:\n\n```\nconst { fetch, setVariables } = new PostmanFetch(postmanCollection, options);\n\nexport {\n    fetch,\n    setVariables\n};\nexport default fetch;\n```\n\nAnd then in another file your need to pass an object as new variables to update the PostmanFetch class:\n\n```\nimport { setVariables } from '/path/to/fetch.js';\n\nconst newVariables = {\n    userToken: 'new jwt token',\n    ...\n};\nsetVariables(newVariables); //this method only update the passed property!\n```\n\n## Examples\n\nIn Example directory there is a express application that provide book resource in rest structure. And also there is a React application that using the postman-fetch package for making the API calls.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamednn76%2Fpostman-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamednn76%2Fpostman-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamednn76%2Fpostman-fetch/lists"}