Appendix D. Using the HyperCLI

The hyper utility is a simple command-line style shell/REPL for interacting with online services/APIs. While a fully functional HTTP client, hyper is especially good at dealing with hypermedia services, including Collection+JSON, SIREN, and HAL. There are plans to add support for PRAG+JSON, MASH+JSON, and possibly UBER in the future. Other media type support can be added via plug-ins, too.

Along with HTTP and media type-aware commands, hyper also supports some convenience functionality like shell commands, configuration file management, and a LIFO stack to handle local memory variables.

Note

You can access tutorials, examples, the source code, and the latest release of the HyperCLI tool via the HyperCLI landing page.

Hello, Hyper!

Here’s a super simple HyperLANG script:

GOTO https://company-atk.herokuapp.com

And here’s how you do it:

  1. Make sure you have installed the latest update of the HyperCLI:

    $> npm install -g @mamund/hyper
  2. Launch the HyperCLI REPL:

    $> hyper
  3. Type the following command and press Enter:

    > GOTO https://company-atk.herokuapp.com

It may take a few seconds for the sample service to fire up, but eventually you should see the following response:

STATUS 200
https://company-atk.herokuapp.com
application/forms+json; charset=utf-8

You can also view the request/response details with these commands:

SHOW REQUEST
SHOW RESPONSE
SHOW METADATA
SHOW ALL
SHOW URL
SHOW STATUS
SHOW CONTENT-TYPE
SHOW HEADERS

Finally, you can place all ...

Get RESTful Web API Patterns and Practices Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.