Drop #172 (2023-01-06): Weekend Project Edition

Getting By With A Little Help From AI

black and white robot toy on red wooden table

We kick off the 2023 “Weekend Project Edition” series with a small, exploratory project to help us all get used to our new AI overlords assistants.

HTTPie (pronounced aitch-tee-tee-pie) is a “command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. HTTPie is designed for testing, debugging, and generally interacting with APIs & HTTP servers. The http & https commands allow for creating and sending arbitrary HTTP requests. They use simple and natural syntax and provide formatted and colorized output.”

The core feature set includes:

  • Expressive and intuitive syntax

  • Formatted and colorized terminal output

  • Built-in JSON support

  • Forms and file uploads

  • HTTPS, proxies, and authentication

  • Arbitrary request data

  • Custom headers

  • Persistent sessions

  • Wget-like downloads

  • Linux, macOS, Windows, and FreeBSD support

  • Plugins

  • Documentation

  • Test coverage

You can use their app to play with REST requests and then use them in a terminal shell context, which means you can design a small CLI utility pretty quickly and iterate very fast.

They recently tapped into GPT-3 and have an experimental (free, for now) AI assistant that lets you describe what you want to do in “natural” language and let it handle the details. Here’s an example of me asking it to do something with $WORK’s API:

HTTPie web app pane with "* Lookup an IP address in the GreyNoise Enterprise API using an API key specified in a "key" header and make sure it informs the API server that we accept json" as the prompt

Since this is an imperfect AI, it’s not going to always get stuff right, but if you work on this exercise, you’ll get better at prompt engineering, which is most certainly going to be a biggly in-demand skill as we progress through the next 12–48 months (and beyond). Said skill enhancements will also, then, let you amaze your friends in the next chatbot or AI-art service that pops up and mesmerizes the world for a few weeks.

YOUR MISSION

Pick a focused task involving REST API requests that would be great to have at the ready on the command line, then only use natural language HTTPie prompts to generate the HTTPie CLI command sequences to perform said task(s).

Some prompts if you’re stuck:

  • Fetch weather from one of the APIs in the 2022-12-23 edition and display it in some way

  • (shameless plug) Sign up for a free GreyNoise API key and write a CLI utility to pull some data back

  • Create some utilities for the Fediverse, perhaps something as basic as a Mastodon post utility. Extra points if it handles adding images (with alt-text).

  • Use the Congress API (remember: via HTTPie NATURAL LANGUAGE assists) to write a CLI to see if the pathetic GOP managed to pick a Speaker of the House yet.

FIN

Remember to link to your blog and/or repo with your creations! ☮

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.