Updated Built-in REST Client in PhpStorm 7
Building a REST API? Need to test a call to a web application? Look no further! Earlier this year we bundled a REST client plugin with which we can test HTTP-based APIs right from within our IDE. Since then we’ve added a number of features to it—features that you have requested through our issue tracker. Let’s explore these new features!
The REST Client can be found under Tools | Test RESTful Web Service. A new tab will be opened which gives us the possibility to craft an HTTP request that can call a web application or an API running on a local machine, intranet or Internet server.
Generate Authorization Header
Many APIs require us to provide credentials. We can manually add an Authorization header to the request, or have PhpStorm generate a header based on the username/password entered. No more need to do that base64 encoding manually:
Importing and Exporting Requests
Every HTTP request that is crafted through the REST Client can be exported and imported again later on. This allows us to create a series of HTTP requests that can be used during development, whenever needed. Create it once, export and reuse. We can also add these exports to VCS so team members can benefit from them:
An exported HTTP request is stored in an XML file which roughly looks like the following. When building an API yourself, why not generate a bunch of sample HTTP requests and distribute them together with your project? That would mean customers and users of our API can run some sample requests from within their IDE:
When an HTTP request has been executed, the REST Client will keep it available from the Recent Requests list, available from the toolbar. From here, we can replay HTTP requests that have been issued in the past, making it easier to work with a series of HTTP requests and switch between them:
In addition to these new features, we’ve added a number of other improvements. For example, there’s now support for compressed responses and Chinese character sets. Want more? Let us hear your feature requests through the issue tracker, the comments below or in our forums!
Develop with pleasure!
– JetBrains PhpStorm Team