nushell-http-api
This skill should be used when the user asks to "make HTTP requests in Nushell", "call an API", "fetch data from URL", "POST JSON data", "handle webhooks", "work with REST APIs", "authenticate API calls", "parse API responses", or mentions http get, http post, web requests, REST, or API integration in Nushell.
What this skill does
# Nushell HTTP & API Integration
Comprehensive guide for making HTTP requests, integrating with REST APIs, and handling webhooks in Nushell. Native HTTP commands return structured data, making API responses immediately usable in pipelines.
## HTTP Commands Overview
| Command | Description |
|---------|-------------|
| `http get` | GET request, returns parsed response |
| `http post` | POST with body |
| `http put` | PUT request |
| `http patch` | PATCH request |
| `http delete` | DELETE request |
| `http head` | HEAD request (headers only) |
| `http options` | OPTIONS request |
## Basic Requests
### GET Requests
```nushell
# Simple GET - auto-parses JSON
http get https://api.example.com/users
# With query parameters
http get $"https://api.example.com/search?q=($query)&limit=10"
# Access response fields directly
http get https://api.example.com/user/1 | get name
```
### POST Requests
```nushell
# POST JSON body
http post https://api.example.com/users {
name: "Alice"
email: "[email protected]"
}
# POST with content type
http post --content-type application/json https://api.example.com/data {
key: "value"
}
# POST form data
http post --content-type application/x-www-form-urlencoded https://api.example.com/form $"username=($user)&password=($pass)"
```
### Other Methods
```nushell
# PUT (replace resource)
http put https://api.example.com/users/1 {name: "Updated Name"}
# PATCH (partial update)
http patch https://api.example.com/users/1 {status: "active"}
# DELETE
http delete https://api.example.com/users/1
```
## Headers and Authentication
### Custom Headers
```nushell
# Single header
http get https://api.example.com/data -H {Accept: "application/json"}
# Multiple headers
http get https://api.example.com/data -H {
Accept: "application/json"
X-Request-ID: (random uuid)
User-Agent: "nushell-client/1.0"
}
```
### Authentication Patterns
```nushell
# Bearer token
http get https://api.example.com/protected -H {
Authorization: $"Bearer ($env.API_TOKEN)"
}
# Basic auth
let auth = [$username, $password] | str join ":" | encode base64
http get https://api.example.com/data -H {
Authorization: $"Basic ($auth)"
}
# API key in header
http get https://api.example.com/data -H {
X-API-Key: $env.API_KEY
}
# API key in query string
http get $"https://api.example.com/data?api_key=($env.API_KEY)"
```
### Secure Token Management
```nushell
# Load from environment
def api-client [] {
let token = $env.API_TOKEN? | default (
error make { msg: "API_TOKEN environment variable not set" }
)
{
headers: {Authorization: $"Bearer ($token)"}
base_url: "https://api.example.com"
}
}
# Use client
let client = api-client
http get $"($client.base_url)/users" -H $client.headers
```
## Request Configuration
### Timeouts
```nushell
# Set timeout (default: no timeout)
http get https://api.example.com/slow --max-time 30sec
```
### Redirects
```nushell
# Follow redirects (default: true)
http get https://example.com --redirect-mode follow
# Don't follow redirects
http get https://example.com --redirect-mode manual
```
### Error Handling
```nushell
# Handle HTTP errors
try {
http get https://api.example.com/resource
} catch { |err|
if ($err.msg | str contains "404") {
print "Resource not found"
} else {
error make { msg: $"API error: ($err.msg)" }
}
}
# Check status before processing
def safe-fetch [url: string] {
let response = do { http get $url --full } | complete
if $response.exit_code != 0 {
error make { msg: $"Request failed: ($response.stderr)" }
}
$response.stdout
}
```
## Response Handling
### Parsing Responses
```nushell
# JSON (automatic)
http get https://api.example.com/data
| get items
| where active == true
# XML
http get https://api.example.com/feed.xml
| from xml
| get rss.channel.item
# Raw text
http get https://example.com/page.html --raw
| lines
| where { |line| $line | str contains "keyword" }
```
### Streaming Responses
```nushell
# Large file download
http get https://example.com/large-file.zip | save file.zip
# Stream JSON lines
http get https://api.example.com/stream --raw
| lines
| each { |line| $line | from json }
```
## Pagination
### Offset-Based
```nushell
def fetch-all-pages [base_url: string, --page-size: int = 100] {
mut all_items = []
mut offset = 0
loop {
let url = $"($base_url)?limit=($page_size)&offset=($offset)"
let response = http get $url
let items = $response | get items
$all_items = $all_items ++ $items
if ($items | length) < $page_size {
break
}
$offset = $offset + $page_size
}
$all_items
}
```
### Cursor-Based
```nushell
def fetch-with-cursor [base_url: string] {
mut all_items = []
mut cursor = null
loop {
let url = if $cursor == null {
$base_url
} else {
$"($base_url)?cursor=($cursor)"
}
let response = http get $url
$all_items = $all_items ++ ($response | get data)
if ($response | get has_more) == false {
break
}
$cursor = $response | get next_cursor
}
$all_items
}
```
### Link Header Navigation
```nushell
# GitHub-style pagination
def fetch-github-pages [url: string] {
mut all_items = []
mut next_url = $url
while $next_url != null {
# Note: Would need to parse Link header from full response
let items = http get $next_url
$all_items = $all_items ++ $items
# Parse next page URL from Link header
# Implementation depends on API
$next_url = null # Placeholder
}
$all_items
}
```
## Rate Limiting
### Simple Throttle
```nushell
def throttled-fetch [urls: list<string>, --delay: duration = 100ms] {
$urls | each { |url|
let result = http get $url
sleep $delay
$result
}
}
```
### Exponential Backoff
```nushell
def fetch-with-backoff [url: string, --max-retries: int = 5] {
mut delay = 1sec
for attempt in 1..=$max_retries {
try {
return (http get $url)
} catch { |err|
if $attempt == $max_retries {
error make { msg: $"Failed after ($max_retries) attempts: ($err.msg)" }
}
if ($err.msg | str contains "429") {
print $"Rate limited, waiting ($delay)..."
sleep $delay
$delay = $delay * 2
} else {
error make { msg: $err.msg }
}
}
}
}
```
## API Client Patterns
### Reusable Client Function
```nushell
# Define API client
def github-api [
endpoint: string
--method: string = "GET"
--body: any = null
] {
let base = "https://api.github.com"
let headers = {
Accept: "application/vnd.github.v3+json"
Authorization: $"Bearer ($env.GITHUB_TOKEN)"
}
match $method {
"GET" => { http get $"($base)($endpoint)" -H $headers }
"POST" => { http post $"($base)($endpoint)" $body -H $headers }
"PUT" => { http put $"($base)($endpoint)" $body -H $headers }
"DELETE" => { http delete $"($base)($endpoint)" -H $headers }
}
}
# Usage
github-api "/user/repos" | select name description
github-api "/repos/owner/repo/issues" --method POST --body {title: "Bug", body: "Details"}
```
### Request Builder
```nushell
# Fluent-style request building
def request [] {
{
method: "GET"
url: ""
headers: {}
body: null
timeout: 30sec
}
}
def "request method" [m: string] {
$in | update method $m
}
def "request url" [u: string] {
$in | update url $u
}
def "request header" [key: string, value: string] {
$in | update headers { |r| $r.headers | insert $key $value }
}
def "request body" [b: any] {
$in | update body $b
}
def "request send" [] {
let req = $in
match $req.method {
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.