Command line API (import/export, send request) #3584
Replies: 22 comments
-
+1 for this. We are evaluating Insomnia in the context of using it as a headless test runner. The benefit would be that all developers can write their API specifications, regardless of desktop environment. Being able to use that resulting insomnia files with a CLI version on a docker container would be gold in this scenario 😄 Anything planned? How hard would it be to factor out the UI and create a standalone core that could be run as a CLI client (I'm not above offering my time for that)? |
Beta Was this translation helpful? Give feedback.
-
A headless CLI for running tests would be great. To be useful to us, it would have to be capable of running inside of Travis. |
Beta Was this translation helpful? Give feedback.
-
This is something I've thought about for a while, but could never figure out a good way to interact with it. How would you prefer to reference the request? The only way I can see at the moment is by finding and using the unique ID that each one has. However, that seems like it would be extremely painful. |
Beta Was this translation helpful? Give feedback.
-
I'll let you know once I play around with postman for awhile and figure out its pain points! :) |
Beta Was this translation helpful? Give feedback.
-
Oh ya, I forgot Postman had a CLI. Seems like a good place to start! |
Beta Was this translation helpful? Give feedback.
-
Report back with what you find 😄 👍 |
Beta Was this translation helpful? Give feedback.
-
Hey @mgraham, did you get a chance to play around with the Postman CLI? |
Beta Was this translation helpful? Give feedback.
-
Not yet - still mostly figuring out how to set up test cases in the app itself. Our goal is to have them running in travis, which will require getting them working in the CLI. |
Beta Was this translation helpful? Give feedback.
-
I want to add my support to adding a CLI for Insomnia to use it as a headless test runner. This is one of the reasons we pay for a Postman Pro account, but I would love to dump Postman Pro in favor of Insomnia. |
Beta Was this translation helpful? Give feedback.
-
Yeah, Postman is so clunky! One opportunity for Insomnia to improve upon Postman would be allowing referring to a specific test case (and all of its template data, etc.) by a URL. With Postman, we create a test case, and then in Pivotal Tracker stories and our Github PRs, we refer to the Postman test case and template by their names. It makes for a very manual QA process. Another great feature (and I realize this is a long shot) would be to integrate with some sort of click testing tool like Selenium; so you could do things like:
I realize that click testing is completely out of scope for an API tool, but maybe there's some sort of fancy integration with a click testing tool that would make interleaved API tests and click tests possible. |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Beta Was this translation helpful? Give feedback.
-
why is this closed? I Googled here because this feature is what I am looking for. if it were around I'd be using it right now. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I'd say it's still an important issue. |
Beta Was this translation helpful? Give feedback.
-
I think that you should start with a simple cli that just exports and imports Insomnia settings. |
Beta Was this translation helpful? Give feedback.
-
fyi, it looks like that someone is taking action. https://www.npmjs.com/package/insomnia-cli |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Beta Was this translation helpful? Give feedback.
-
I think it's still a valid long-term feature request |
Beta Was this translation helpful? Give feedback.
-
I wanted something which postman can't give and won't give.
|
Beta Was this translation helpful? Give feedback.
-
I would love to see a stable, headless command line runner for insomnia request collection exports.
Two design features give insomnia a huge advantage over postman:
These two features combined allows insomnia-cli to automatically figure out how to run requests concurrently! The request call graph can be determined through the response value tags (it's a directed acyclic graph unless there's a closed cycle of response tags). And immutable environment variables eliminate error-prone manual variable management (looking at you, postman test scripts). During the runtime, the runner only needs to be responsible for making requests, exposing the result to subsequent requests, and then rendering the overall results to console output. Any request that fails (hopefully based on a user-defined condition) can fail an entire sub-tree of the graph. insomnia-cli was hacked together over a weekend, so the smallest steps were taken to get the above concept working. The set of requests to run are specified by top-level folder names—all the requests in the folder will be run. If there are no response value tag dependencies, all the requests will just be run together. The object of environment variables is specified by sub-environment name. This is due to my own usage pattern: I’ve never added to or used the global environment. Separating out the core from the UI would help with this in the future. The core piece would only expose an API for the networking, persistence, and Insomnia-specific resources. Then the electron UI and a command line runner could be two frontends to the same insomnia core. Edit: Actually, found the initial fork and UI removal commits: https://github.com/mtso/insomnia/commits/cli |
Beta Was this translation helpful? Give feedback.
-
Currently use newman (postman cli) for executing api tests on CI. Store test suites in postman format. |
Beta Was this translation helpful? Give feedback.
-
@alexus1024 dredd is fantastic for running tests against the examples in a swagger/OAS contract (v2 |
Beta Was this translation helpful? Give feedback.
-
Here is a Node.js script to export a workspace from Insomnia. It mostly boils down to this function https://github.com/dgroomes/nedb-playground/blob/0d20d10407408dfa6cd6a8d16ccd27ef65249a74/insomnia.js#L84 You use it with +1 for the CLI-based export/import feature request. If I had it then I think it would motivate me to export my 100+ requests that I've created over the years (the APIs for lots of DevOps tools and the APIs of our own system) and share them in version control for my colleagues! If I can get into a workflow of easily syncing my workspace with Git, that would be ideal. I see some really cool "Git syncing" and CLI functionality ( I'm happy to try to restructure some things in Insomnia but didn't know where to start. Do you view that |
Beta Was this translation helpful? Give feedback.
-
Detaills
A command line API for import/export of workspaces or sending a request with a specific environment would be great.
Or is this even possible?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions