RestApiToText is a plugin that will use the text from a Notepad++ editor tab to make a REST call and display the results in a new editor tab, eliminating the need for calling an outside REST tool and pasting the results into Notepad++. Special thanks to Don Ho and the many developers and contributors for making Notepad++ possible.
License
All files for this package are licensed under the GPL v3 license. See the LICENSE file for more details.
What's New in RestApiToText
- Added the ability to use an environment variable when specifying header values, so that you can use a private API key without showing it in your REST call.
- RestApiToText will automatically pretty-print JSON responses if the response header's Content-Type header is set to application/json.
- Added new RestApiToTextOptions section to allow users to control the behavior of RestApiToText.
- Added the ShowResponseHeaders RestApiToText option to display response headers in addition to the response itself.
- Querystrings are now url-encoded before they are sent.
- Added the ability to pass a body with the DELETE verb.
- Fixed issue where the PATCH verb was not passing the body.
- Fixed issue where InternetReadFile was stopping prematurely because the output was being formatted to JSON as it was being read.
- Fixed issue where the 201 (Created) response was not returning the body.
- Added ability to use environment variables in the body and the URL.
- Added ability to show response on the same page, after the REST call.
- Fixed issue where body was not being returned on all calls.
New Releases
You can download the latest version of RestApiToText.dll for 32-bit here and for 64-bit here or by navigating the Release and x64/Release folders above. You just need to download the DLL and overwrite it in the appropriate subfolder of the Notepad++ plugins admin folder.
Here are the steps to overwrite the DLL:
- Open Notepad++ and go to Plugins->Open Plugins Folder...
- Close Notepad++.
- In the Explorer window you created from Step 1, open the RestApiToText subfolder.
- Overwrite the RestApiToText DLL with the one you downloaded.
- Reopen Notepad++.
See Changes by Version below for a list of changes.
Usage
- Add code in the format shown below.
- Go to Plugins -> REST API To Text -> Make REST Call.
- A new editor tab with the results of the call should appear. (Results depend on the API you call)
- If the response's Content-Type header is application/json then the output will be automatically formatted:
Notes
- RestApiToText always creates a new tab for the results, so you can easily keep different versions for reference.
- Only the verb and the URL are required. Headers, RestApiToTextOptions and Body are always optional.
- The HTTP/S protocol at the beginning of the URL is not required. The port is also optional.
- The current version of the plugin will only make one call at a time.
- If the editor tab contains more content than your REST call (or other non-REST content), then select all of the REST text before making the call.
- You can also make calls to regular web pages.
- RestApiToText also supports the most commonly used REST verbs. The content returned depends on the API call. Some verbs might return no content, depending on the REST API you're calling and how you've configured the call. Here are some examples:
- Use an environment variable whenever you want to send a private API key but you don't want to show it in your REST call. Just create the variable and wrap it in a $(env:variable name) expression, like so:
- Use the RestApiToTextOptions section for custom RestApiToText features:
(The following two features are currently available)
Changes by Version
1.4.0.1
- Fixed issue where body was not being returned on all calls.
1.4.0.0
- Added the ability to use an environment variable in the body and the URL.
- Added the ability to show the response on the same page as the REST call.
1.3.1.2
- Added the ability to use an environment variable in the body.
1.3.1.1
- Fixed bug where 201 responses did not include the body.
1.3.1.0
- Added the ability to use an environment variable when specifying header values, so that you can use a private API key without showing it in your REST call.
1.3.0.0
- Added new RestApiToTextOptions section to allow users to control the behavior of RestApiToText.
- Added RestApiToText option called ShowResponseHeaders to display response headers in addition to the response itself.
- URL querystrings are now encoded before they are sent.
- Added the ability to pass a body with the DELETE verb.
- Fixed issue where the PATCH verb was not passing the body.
1.2.1
- Fixed issue where InternetReadFile was stopping prematurely because the output was being formatted to JSON as it was being read.
1.2
- Added JSON pretty-printing for responses with a Content-Type response header containing "application/json".
- Added support for the HEAD and OPTIONS verbs.
- URLs with no verb now default to a GET.
1.1
- Fixed incorrect HTTP/S configurations that would result in "400 - Bad Request" or "405 - Method Not Allowed" in some situations.
- Disabled default WinInet caching.
1.0
- Initial release.