diff options
Diffstat (limited to 'data')
| -rw-r--r-- | data/skyfi-api.rest | 85 | ||||
| -rw-r--r-- | data/tutorial-api.rest | 140 |
2 files changed, 225 insertions, 0 deletions
diff --git a/data/skyfi-api.rest b/data/skyfi-api.rest new file mode 100644 index 00000000..9a5a4267 --- /dev/null +++ b/data/skyfi-api.rest @@ -0,0 +1,85 @@ +# -*- restclient -*- +# +# SkyFi Satellite Imagery API +# https://app.skyfi.com/platform-api/redoc +# +# KEY INJECTION: +# The :skyfi-key variable below is auto-populated from authinfo.gpg +# when you open this file via C-; R s. The key is NEVER stored on disk. +# If you see PLACEHOLDER, run C-; R s again or check your authinfo.gpg. +# +# authinfo.gpg entry format: +# machine app.skyfi.com login apikey password YOUR_API_KEY_HERE + +:skyfi-key = PLACEHOLDER +:skyfi-base = https://app.skyfi.com/platform-api + +# +# ============================================================ +# Archive Search — find available satellite imagery +# ============================================================ +# + +# Search for imagery over an area of interest (AOI) +# Adjust the GeoJSON polygon, date range, and cloud cover as needed +POST :skyfi-base/archive/search +Content-Type: application/json +APIKey: :skyfi-key + +{ + "aoi": { + "type": "Polygon", + "coordinates": [[ + [-90.10, 29.95], + [-90.05, 29.95], + [-90.05, 29.98], + [-90.10, 29.98], + [-90.10, 29.95] + ]] + }, + "dateFrom": "2025-01-01T00:00:00Z", + "dateTo": "2025-12-31T23:59:59Z", + "cloudCover": 20 +} + +# +# ============================================================ +# Pricing — get cost estimate for an archive item +# ============================================================ +# + +# Replace ARCHIVE_ID with an ID from the search results above +# TIP: Use jq to extract IDs: -> jq-set-var :archive-id .[0].id +POST :skyfi-base/pricing +Content-Type: application/json +APIKey: :skyfi-key + +{ + "archiveId": "ARCHIVE_ID_HERE", + "aoi": { + "type": "Polygon", + "coordinates": [[ + [-90.10, 29.95], + [-90.05, 29.95], + [-90.05, 29.98], + [-90.10, 29.98], + [-90.10, 29.95] + ]] + } +} + +# +# ============================================================ +# Orders — place and check orders +# ============================================================ +# + +# Check order status (replace ORDER_ID) +GET :skyfi-base/orders/ORDER_ID_HERE +APIKey: :skyfi-key + +# + +# List recent orders +GET :skyfi-base/orders +APIKey: :skyfi-key diff --git a/data/tutorial-api.rest b/data/tutorial-api.rest new file mode 100644 index 00000000..6820cd87 --- /dev/null +++ b/data/tutorial-api.rest @@ -0,0 +1,140 @@ +# -*- restclient -*- +# +# REST API Tutorial — Free Public APIs +# +# QUICK START: +# 1. Place cursor on any request line (GET, POST, etc.) +# 2. C-c C-c — execute request, results appear below +# 3. C-c C-p — jump to previous request +# 4. C-c C-n — jump to next request +# 5. TAB — hide/show response body +# +# SYNTAX BASICS: +# - Lines starting with # are comments +# - Blank line separates comment/header blocks from the request +# - :var = value defines a variable, use it as :var in requests +# - Requests: METHOD URL, then headers, then body after blank line +# +# VARIABLES: +# Define once, reuse everywhere. Variables persist across requests +# in the same buffer. + +:jsonplaceholder = https://jsonplaceholder.typicode.com +:httpbin = https://httpbin.org + +# +# ============================================================ +# JSONPlaceholder — fake REST API for testing +# ============================================================ +# + +# GET a single post +GET :jsonplaceholder/posts/1 + +# + +# GET all posts by user 1 +GET :jsonplaceholder/posts?userId=1 + +# + +# POST a new post (returns 201 with fake ID) +POST :jsonplaceholder/posts +Content-Type: application/json + +{ + "title": "Testing from Emacs", + "body": "restclient.el is great for API exploration.", + "userId": 1 +} + +# + +# PUT (full update) — replaces post 1 +PUT :jsonplaceholder/posts/1 +Content-Type: application/json + +{ + "id": 1, + "title": "Updated Title", + "body": "Updated body text.", + "userId": 1 +} + +# + +# PATCH (partial update) — only update the title +PATCH :jsonplaceholder/posts/1 +Content-Type: application/json + +{ + "title": "Just the title changed" +} + +# + +# DELETE a post +DELETE :jsonplaceholder/posts/1 + +# +# ============================================================ +# httpbin — HTTP echo service +# ============================================================ +# + +# Echo back request headers (great for debugging auth) +GET :httpbin/headers + +# + +# Send custom headers and see them echoed back +GET :httpbin/headers +X-Custom-Header: hello-from-emacs +Accept: application/json + +# + +# Test Basic Auth (user: testuser, pass: testpass) +# httpbin checks credentials and returns 200 or 401 +GET :httpbin/basic-auth/testuser/testpass +Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M= + +# + +# See your external IP +GET :httpbin/ip + +# + +# Test different status codes (change 418 to any HTTP status) +GET :httpbin/status/418 + +# + +# POST with form data +POST :httpbin/post +Content-Type: application/x-www-form-urlencoded + +name=Craig&tool=restclient + +# +# ============================================================ +# Tips & Tricks +# ============================================================ +# +# JQ FILTERING (requires jq installed + restclient-jq): +# Add -> jq-set-var :varname .path after a request to capture +# a value from the JSON response into a restclient variable. +# +# MULTI-LINE BODIES: +# Just write the JSON/XML body after a blank line. restclient +# sends everything until the next # comment line. +# +# FILE ORGANIZATION: +# Save related requests together in .rest files (e.g., per API +# or per project). Open them with C-; R o. +# +# WORKFLOW: +# 1. Start with C-; R n (scratch buffer) for quick experiments +# 2. Save working requests to a .rest file for reuse +# 3. Use variables for base URLs and auth tokens |
