Expedite use of web APIs

Make a request or discuss new features.
Post Reply
User avatar
Posts: 1784
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Expedite use of web APIs

Post by pjj »

This is perhaps not a feature request per se, but rather a general idea you might want to mull over.

Recently I've decided I want to ship minified JS files. For a moment I thought about writing my own simple minifier, but it quickly turned out those mature minifiers available freely on the Net were doing their job far better (plus they're available right off-the-bat, saving the hassle of coding and testing); one of them even offered simple API. I concocted a trivial PHP script and even simpler batch file and wired it to the Tools menu. Now, whenever I open up JS file in RJ TE and press an icon, minified script is saved in the same location, with ".min" suffix added to its original name.

Now, wouldn't it be great if RJ TE natively offered possibility of employing web APIs, so users would be spared writing their own helpers? There's a wide panoply of possible use cases: minifiers, beautifiers, linters, etc. etc. It could work like this: document text is sent to an API point, and output is loaded into the new tab, or to a new tab with "compare documents" flag on, or to the current tab (with confirmation dialog, of course), or to the clipboard, or simply saved to disk in the background.

I understand there may be a variety of API configuration options, but perhaps it's not so wide after all: URL of the endpoint, sending method (POST, GET [?]), MIME type of the content sent (e.g. 'application/x-www-form-urlencoded'), maybe authorization credentials (which could be implemented later)...

Food for thought! :wink:

The JS minifier I mentioned is here (there is also CSS minifier by the same author.)

(If someone is interested in my script, let him just holler!)
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

User avatar
Rickard Johansson
Site Admin
Posts: 6000
Joined: 19 Jul 2006 14:29

Re: Expedite use of web APIs

Post by Rickard Johansson »

Added a simple implementation in tools (v14.20).

Added a type to send POST requests. It is used to post the current document or a selection to a web address and open the returned text in a new document tab.

I also added two new presets. One will add the following:

Code: Select all

Title:	'JavaScript Minifier'
Type:	'Send POST request to URL'
Command:	'https://javascript-minifier.com/raw'
Argument:	'input=[CurrentDocument]'

Post Reply