{"id":15013993,"url":"https://github.com/flashcode/impostman","last_synced_at":"2025-04-10T01:13:06.262Z","repository":{"id":45436936,"uuid":"328466199","full_name":"flashcode/impostman","owner":"flashcode","description":"Import of Postman collections in Emacs","archived":false,"fork":false,"pushed_at":"2024-10-19T14:37:40.000Z","size":229,"stargazers_count":72,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T01:13:00.787Z","etag":null,"topics":["api","emacs","http","postman","restclient","verb"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flashcode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-01-10T19:50:18.000Z","updated_at":"2024-11-30T09:57:27.000Z","dependencies_parsed_at":"2025-01-01T21:12:09.168Z","dependency_job_id":"c3ce2480-fdab-4cf7-bdbe-0981ab5135e1","html_url":"https://github.com/flashcode/impostman","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashcode%2Fimpostman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashcode%2Fimpostman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashcode%2Fimpostman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashcode%2Fimpostman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flashcode","download_url":"https://codeload.github.com/flashcode/impostman/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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":["api","emacs","http","postman","restclient","verb"],"created_at":"2024-09-24T19:45:02.609Z","updated_at":"2025-04-10T01:13:06.229Z","avatar_url":"https://github.com/flashcode.png","language":"Emacs Lisp","readme":"# Import of Postman collections in Emacs\n\n[![Build Status](https://github.com/flashcode/impostman/workflows/CI/badge.svg)](https://github.com/flashcode/impostman/actions?query=workflow%3A%22CI%22)\n[![MELPA](https://melpa.org/packages/impostman-badge.svg)](https://melpa.org/#/impostman)\n[![MELPA Stable](https://stable.melpa.org/packages/impostman-badge.svg)](https://stable.melpa.org/#/impostman)\n\nPostman collections and environments can be imported and used with these Emacs HTTP clients:\n\n- [verb](https://github.com/federicotdn/verb)\n- [restclient](https://github.com/pashky/restclient.el)\n- other clients with your own functions, see [Add new output](#add-new-output).\n\n## Requirements\n\nThis package requires:\n\n- Emacs ≥ 27.1 (it uses the native support for JSON introduced in Emacs 27).\n\nOptional dependencies:\n\n- [verb](https://github.com/federicotdn/verb)\n- [restclient](https://github.com/pashky/restclient.el).\n\nNote: without these optional dependencies, you can still convert to all formats, but the mode will not be set in the buffer once converted.\n\n## Installation\n\nYou can install Impostman with `package-install` command, either from [MELPA](https://melpa.org/) or [MELPA Stable](https://stable.melpa.org/):\n\n\u003ckbd\u003eM-x\u003c/kbd\u003e `package-install` \u003ckbd\u003eRET\u003c/kbd\u003e `impostman` \u003ckbd\u003eRET\u003c/kbd\u003e\n\nAlternatively, you can deploy impostman.el into your site-lisp as usual, then add this line to your Emacs initialization file:\n\n```elisp\n(require 'impostman)\n```\n\n## Usage\n\nTwo functions can be called interactively to import a Postman collection, with an optional environment:\n\n- \u003ckbd\u003eM-x\u003c/kbd\u003e `impostman-import-file` \u003ckbd\u003eRET\u003c/kbd\u003e\n- \u003ckbd\u003eM-x\u003c/kbd\u003e `impostman-import-string` \u003ckbd\u003eRET\u003c/kbd\u003e\n\nThe function `impostman-import-file` takes three optional parameters (they are asked interactively if not provided):\n\n- `collection` (optional): the Postman collection\n- `environment` (optional): the Postman environment (must be given if variables are used in the collection, can be empty string if the collection does not use any variable from an environment)\n- `output` (optional): the output type: `verb`, `restclient` or your custom output.\n\nExample:\n\n```elisp\n(impostman-import-file \"/path/to/collection.json\" \"/path/to/environment.json\" \"verb\")\n```\n\nThe function `impostman-import-string` takes three parameters (the third is optional and asked interactively if not provided):\n\n- `collection`: the string with the collection (JSON format)\n- `environment`: the string with the environment (JSON format) (must be given if variables are used in the collection, can be empty string if the collection does not use any variable from an environment)\n- `output` (optional): the output type (`verb` or `restclient`).\n\nExample:\n\n```elisp\n(impostman-import-string \"{}\" \"\" \"verb\")\n```\n\nThe result is displayed in a new buffer with the Emacs HTTP client, and the mode is set to:\n\n- verb: `org-mode` (major) and `verb-mode` (minor)\n- restclient: `restclient-mode`.\n\n## Customization\n\nSome options can be customized to alter the output, you can list and change them with:\n\n\u003ckbd\u003eM-x\u003c/kbd\u003e `customize-group` \u003ckbd\u003eRET\u003c/kbd\u003e `impostman` \u003ckbd\u003eRET\u003c/kbd\u003e\n\nList of variables:\n\n- `impostman-auth-basic-as-elisp-code` (boolean, default: `t`): convert Basic authentication header to elisp code so that the username and password can be easily edited; if set to `nil`, the header is written in Base64\n- `impostman-use-variables` (boolean, default: `t`): keep Postman variables in the output and define variables according to the\noutput; if set to `nil`, no variables are used, they are directly replaced by their values during the import of collection\n- `impostman-outputs-alist` (alist, default keys: `verb` and `restclient`): list of outputs, see [Add new output](#add-new-output).\n\n## Add new output\n\nTwo low-level functions can also be called (non interactively), with a custom output (alist).\n\nThis alist must be defined like this, for example if your output is for walkman (another HTTP client for Emacs):\n\n```elisp\n(defconst my-impostman-walkman-alist\n  '((init . my-impostman-walkman-init)\n    (replace-vars . my-impostman-walkman-replace-vars)\n    (header . my-impostman-walkman-header)\n    (item . my-impostman-walkman-item)\n    (request . my-impostman-walkman-request)\n    (footer . my-impostman-walkman-footer)\n    (end . my-impostman-walkman-end))\n  \"Emacs walkman output\")\n```\n\nKeys are fixed symbols and values are [callback functions](#callback-functions).\n\nA function can be `ignore`, in this case it is simply ignored, for example if you don't have anything to do for `init` and `end`:\n\n```elisp\n(defconst my-impostman-walkman-alist\n  '((init . ignore)\n    (replace-vars . my-impostman-walkman-replace-vars)\n    (header . my-impostman-walkman-header)\n    (item . my-impostman-walkman-item)\n    (request . my-impostman-walkman-request)\n    (footer . my-impostman-walkman-footer)\n    (end . ignore))\n  \"Emacs walkman output\")\n```\n\nThen you can call for a file:\n\n```elisp\n(impostman-parse-file \"/path/to/collection.json\" \"/path/to/environment.json\" my-impostman-walkman-alist)\n```\n\nAnd for a string:\n\n```elisp\n(impostman-parse-string \"{}\" \"\" my-impostman-walkman-alist)\n```\n\nYou can also add your output to the list of impostman outputs, so you can use it with `impostman-import-file` and `impostman-import-string`:\n\n```elisp\n(push '(\"walkman\" . my-impostman-walkman-alist) impostman-outputs-alist)\n```\n\nThis will put your output at the beginning of the alist, so it will be the default output.\n\n### Callback functions\n\n#### init\n\n```elisp\n(defun xxx-init (variables)\n  (...))\n```\n\nFunction called when the output buffer is created and before parsing the collection.\n\nArguments:\n\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### replace-vars\n\n```elisp\n(defun xxx-replace-vars (string variables)\n  (...))\n```\n\nFunction called to replace Postman variables (format: `{{variable}}`) in a string. It must return a string where the Postman variables have been replaced by the appropriate value (according to the output).\n\nNote: according to the option `impostman-use-variables`, a variable is either replaced with a reference (by default and the format depends on the output) or directly with its value, if the option is set to nil.\n\nArguments:\n\n- `string` (string): any string\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### header\n\n```elisp\n(defun xxx-header (name description variables)\n  (...))\n```\n\nFunction called after `init` and before parsing the collection. It must return a string which is inserted in the output buffer.\n\nArguments:\n\n- `name` (string): collection name (`unknown` if not found)\n- `description` (string): collection description\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### item\n\n```elisp\n(defun xxx-item (level name description variables)\n  (...))\n```\n\nFunction called for each item read (a folder in Postman). It must return a string which is inserted in the output buffer.\n\nArguments:\n\n- `level` (integer): folder level (≥ 2)\n- `name` (string): item name\n- `description` (string): item description\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### request\n\n```elisp\n(defun xxx-request (description method url headers body variables)\n  (...))\n```\n\nFunction called for each request read. It must return a string which is inserted in the output buffer.\n\nArguments:\n\n- `description` (string): request description\n- `method` (string): the HTTP method (`GET`, `POST`, `PUT`, …)\n- `url` (string): request URL\n- `headers` (alist): request headers (in reverse order: latest header read is the first one in alist)\n- `body` (string): request body\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### footer\n\n```elisp\n(defun xxx-footer (name variables)\n  (...))\n```\n\nFunction called at the end of parsing. It must return a string which is inserted in the output buffer.\n\nArguments:\n\n- `name` (string): collection name (`unknown` if not found)\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n#### end\n\n```elisp\n(defun xxx-end (variables)\n  (...))\n```\n\nFunction called at the end. It can be used to enable a major or minor mode.\n\nArguments:\n\n- `variables` (alist): variables from collection and environment (in reverse order: latest variable read is the first one in alist).\n\n## Known limitations\n\nFor now the package offers a basic support of Postman collections and environments, the following features are partially implemented:\n\n- authentication: only `basic` and `apikey` are supported\n- body: only `raw` is supported.\n\nPull requests are welcome to add missing features.\n\n## Copyright\n\nCopyright © 2020-2024 [Sébastien Helleu](https://github.com/flashcode)\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashcode%2Fimpostman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflashcode%2Fimpostman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashcode%2Fimpostman/lists"}