Using the REST Client within PhpStorm and WebStorm
When building REST-based web APIs, it’s worth having a tool available to invoke them over HTTP. The current versions of WebStorm 6, PhpStorm 6, RubyMine 5.4 and PyCharm contain a bundled REST Client plugin which allows us to do just that.
In this blog post, we’ll have a quick look at the built-in features of the REST Client and on how to use them.
In this post, we’ll be using PhpStorm as our IDE, invoking an API built using the Silex framework which is similar to frameworks like Sinatra and Nancy. The API we’ll be testing using the REST Client plugin is fairly straightforward: it exposes an array of users through a REST endpoint. The /users endpoint returns the entire array of users. The /users/:id endpoint returns a specific user when issuing a GET request and writes a user to the array when issuing a PUT request. The source code for this API is available as a GitHub Gist:
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 which will be invoked against our API. We can specify the HTTP method to be used, the host where our API is located, and the path to be invoked. Other than that, we can add header data as well as query string parameters or a request body to be sent to the API.
Upon invoking the request by clicking the green Run button, the REST Client connects to our API and gathers the response data. We can easily inspect the response body as well as the response headers, each available through their own result tab.
To create a user in our API, invoke a PUT request providing JSON data in the request body. We can provide the request body by entering the text or by selecting a file to upload as the body.
Develop with pleasure!
– JetBrains Web IDE Team
Working with Windows Azure SQL Database in PhpStorm
PhpStorm provides us the possibility to connect to Windows Azure SQL Database right from within the IDE. In this post, we’ll explore several options that are available for working with Windows Azure SQL Database (or database systems like SQL Server, MySQL, PostgreSQL or Oracle, for that matter): …
Change signature refactoring in PhpStorm
A very powerful refactoring is the Change signature refactoring in PhpStorm. It enables us to modify a function signature in many ways: we can change the function name, change its visibility, add, remove and reorder parameters as well as rename parameters. (more…)…
Folding for imports in PhpStorm 6.0
In PhpStorm 6, we've introduced code folding for imports. Any list of imports will now be folded into a single line. This greatly reduced clutter in your editor when having a lot of imports! (more…)…
Drag & Drop Project Files to Remote Hosts in PhpStorm
The Remote Host pane allows us to work directly on a remote server through FTP, FTPS, SFTP or a local/network folder. A lot of people asked us to add drag & drop to the Remote Host pane in PhpStorm. Good news: PhpStorm 6 comes with drag & drop as well as copy & paste support from the pro…