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
Sort an array
echo:[3,1,4,1,5,9,2,6]|sort
Sort, reverse, take first 3
echo:[3,1,4,1,5,9,2,6]|sort|reverse|head:3
Deduplicate values
echo:[1,2,2,3,3,3]|uniq
Get first item from an array
echo:[3,1,4,1,5]|sort|first
Fetch repos, sort by stars
fetch:https://api.github.com/users/octocat/repos|rsort:stargazers_count|head:5|pick:name,stargazers_count
Fetch repos as CSV
fetch:https://api.github.com/users/octocat/repos|rsort:stargazers_count|head:5|pick:name,stargazers_count|csv
Pluck names, sort alphabetically
fetch:https://api.github.com/users/octocat/repos|pluck:name|sort
Count items in a remote array
fetch:https://api.github.com/users/octocat/repos|count
Commands
37Sources
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,2900Caching
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=60POST endpoint
Send your own data as a JSON body to /api/pipe with input and pipeline.
{
"input": [{"n":"b"},
{"n":"a"}],
"pipeline": "sort:n"
}