Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As I have also been frustrated with the direction Postman has taken, I have a great alternative to suggest, if the only thing you want to do is fire requests on demand easily and do not need automated testing.

The VS Code Rest Client extension https://marketplace.visualstudio.com/items?itemName=humao.re... is great for testing and debugging APIs.

You create a "my_request.http" file that contains something like

  POST https://example.com/comments HTTP/1.1
  content-type: application/json

  {
    "name": "sample",
    "time": "Wed, 21 Oct 2015 18:27:50 GMT"
  }
First line is the method and url, then headers, then a newline, then the request body.

Hit ctrl+alt+p, the request is sent and you see the response in a side pane. Everything is encoded and decoded properly.

You can organize your tests under multiple files and folders.

I cannot recommend this extension enough, it has made my life so much easier.



Can it do substitution with some sort of application-based KV store? The main reason I used a rest client like Insomnia is so that I can reference secrets like {{ client_secret }} or {{ api_key }} and have a change to the value in the KV store reflect for every request.


Yes it supports variables, don't know about KV store, see: https://marketplace.visualstudio.com/items?itemName=humao.re...


Yes, it seems like it:

"We support two types of variables, one is Custom Variables which is defined by user and can be further divided into Environment Variables, File Variables and Request Variables, the other is System Variables which is a predefined set of variables out-of-box."

However, what I can't figure out is if it supports programmatic variable setting. I have an API where I need to retrieve a token from an endpoint before using it for every other endpoint, and I'm using Postman's test scripts to set that token as an environment variable before sending all the other requests so they can all use it. I don't see a way to replicate that with this extension.


You can do it with intelij


Someone posted https://hurl.dev/ below. It looks like a command-line alternative to this, with a similar format, and support for assertions.


Hi, one of the maintainer of Hurl [1]. It is effectively basically just curl (we're using libcurl under the hood). I would say that we have added the ability to chain request (you could use curl in a shell script), and a bunch of assert (like jsonpath, xpath etc...) on response (which you could arguably do also with shell script).

We also wanted something text based, that could easily be integrated in a CI [2] for instance. We are using Hurl to test our web application (~2M unique visitors/month). Very happy with it currently, but there are really a lot of very good tools in this space (as we can see in these comments).

[1] https://hurl.dev

[2] https://hurl.dev/docs/tutorial/ci-cd-integration.html


I too like this approach, because the format is simple and text-based and you can maintain it in your git repository.

My main gripe with Postman and Insomnia isn't actually the web based UI, but the lock-in. You can't access the files that they store their data in easily. Postman especially tries to push people towards getting their per-seat 'cloud' subscription if you want to share sets of HTTP requests.

But using this text-based REST client, you don't have this file lock-in.

For IntelliJ this feature is actually built in, I believe it uses the same syntax.


Shameless plug: There's also Prestige at https://prestigemad.com, which is very similar but works right in the browser. You can save your files as Gists as well. Templating with variables is also supported with `${}` syntax, like Javascript's template strings.

But gRPC support is not built yet. It's on the roadmap.


For you Emacsers that haven't heard of it, the alternative to this https://github.com/pashky/restclient.el

Super straightforward.


There's also insomnia: http://insomnia.rest/

Which is an open source, cross platform alternative to postman.


Also, Thunder client is a lightweight REST API client extension for VS Code. Good fit for basic usage requirements.


Doesn’t curl do this just as easily?


Sounds a lot easier than curl tbh. No need to deal with shell scripts and their insane quoting, plus you get the response straight in your editor with syntax highlighting.


Maybe it’s just me but I’ve never had those issues. Another benefit of curl is that you have an easily searchable history of every command you’ve run. So you can easily find old invocations and rerun them.


This extension also keeps a history of requests.

How complicated are your requests? If I need to test a POST request with a JSON payload longer than a line or two, I'll go and construct my curl command in a text editor anyway, since the shell prompt / readline is not easy to edit. Once you need to start escaping single or double quotes or html payloads in the request, it quickly gets cumbersome. At that point I ditch the shell as a middleman and use the editor to submit the request for me.


You can have curl read the request body from a file using --data @filename.txt.


Which means you've opened an editor already to edit the request. Might as well send the request right there via an editor command/plugin.


Or you saved the response from a different curl request, or it’s checked into git, or a million different reasons.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: