httpip.es

Unix pipes over HTTP

Fetch any JSON API, then transform it with a chain of commands. Sort, filter, pick fields, export as CSV. The URL is the program.

$ curl -gL 'httpip.es/api/pipe/echo:[5,3,1,4,2]|sort|head:3'
[1,2,3]

How it works

Commands are separated by |, arguments follow a :, multiple arguments are separated by ,.

/api/pipe/command:arg1,arg2|command|command:arg
          ───┬─── ────┬──── ───┬─── ───┬─── ─┬─
             │        └ args   │       │     └ arg
             └ command         │       └ command
                               └ command (no args)

Quick start

# Sort an array
$ curl -gL 'httpip.es/api/pipe/echo:[3,1,2]|sort'
[1,2,3]

# Fetch a JSON API, pick fields, sort by stars
$ curl -gL 'httpip.es/api/pipe/fetch:https://api.github.com/users/octocat/repos|rsort:stargazers_count|head:3|pick:name,stargazers_count'

# POST with your own input data
$ curl -gL -X POST httpip.es/api/pipe \
  -H 'Content-Type: application/json' \
  -d '{"input":[5,3,1],"pipeline":"sort|reverse"}'
[5,3,1]

Try it

Commands

37
Sources
fetchecho
Array
sortrsortreverseheadtailflatuniqfirstlastdistinct
Object
pickomitgetkeysvaluesentrieswrapset
Filter
filterreject
Aggregate
countsumminmaxgroup
String / Misc
joinpluckmaptypelengthtemplate
Format
csvtsvlinestext

Features

Output formats

End any pipeline with csv, tsv, lines, or text to change the response format. The Content-Type header is set automatically.

$ curl -gL '...|pick:name,stars|csv'
name,stars
Hello-World,2900
Caching

Add ?cache=N (seconds, max 3600) to set Cache-Control headers. Cached at Vercel's CDN edge.

$ curl -gL '...?cache=300'
# Cache-Control:
#   public, s-maxage=300,
#   stale-while-revalidate=60
POST endpoint

Send your own data as a JSON body to /api/pipe with input and pipeline.

{
  "input": [{"n":"b"},
             {"n":"a"}],
  "pipeline": "sort:n"
}