AgentSkillsCN

http-request-skill

向外部 API 和网络服务发起 HTTP 请求。支持 GET、POST、PUT、DELETE、PATCH 方法,并可携带请求头与 JSON 请求体。

SKILL.md
--- frontmatter
name: http-request-skill
description: Make HTTP requests to external APIs and web services. Supports GET, POST, PUT, DELETE, PATCH methods with headers and JSON body.
allowed-tools: http_request
metadata:
  author: machina
  version: "1.0"
  category: integration
  icon: "🌐"
  color: "#EF4444"

HTTP Request Tool

Make HTTP requests to external APIs and web services.

How It Works

This skill provides instructions for the HTTP Request tool node. Connect the HTTP Request node to Zeenie's input-tools handle to enable API calls.

http_request Tool

Make an HTTP request to any URL.

Schema Fields

FieldTypeRequiredDescription
urlstringYesFull URL to request (e.g., https://api.example.com/data)
methodstringNoHTTP method: GET, POST, PUT, DELETE, PATCH (default: GET)
bodyobjectNoRequest body as JSON object (for POST/PUT/PATCH)

Node Parameters

Additional options can be configured on the node:

ParameterDescription
headersCustom headers as JSON (e.g., {"Authorization": "Bearer token"})
base_urlBase URL prepended to the url parameter

Response Format

json
{
  "status": 200,
  "data": { "key": "value" },
  "url": "https://api.example.com/data",
  "method": "GET"
}

Examples

GET request (fetch data):

json
{
  "url": "https://api.example.com/users/123",
  "method": "GET"
}

POST request (create resource):

json
{
  "url": "https://api.example.com/users",
  "method": "POST",
  "body": {
    "name": "John Doe",
    "email": "john@example.com"
  }
}

PUT request (update resource):

json
{
  "url": "https://api.example.com/users/123",
  "method": "PUT",
  "body": {
    "name": "John Updated"
  }
}

DELETE request:

json
{
  "url": "https://api.example.com/users/123",
  "method": "DELETE"
}

PATCH request (partial update):

json
{
  "url": "https://api.example.com/users/123",
  "method": "PATCH",
  "body": {
    "status": "active"
  }
}

Real-World Examples

Get Bitcoin price:

json
{
  "url": "https://api.coindesk.com/v1/bpi/currentprice.json",
  "method": "GET"
}

Get weather:

json
{
  "url": "https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_KEY",
  "method": "GET"
}

Post to webhook:

json
{
  "url": "https://hooks.slack.com/services/xxx",
  "method": "POST",
  "body": {
    "text": "Hello from MachinaOS!"
  }
}

Check website status:

json
{
  "url": "https://example.com",
  "method": "GET"
}

Error Responses

Timeout:

json
{
  "error": "Request timed out"
}

Connection failed:

json
{
  "error": "Connection failed: Unable to reach host"
}

HTTP error:

json
{
  "status": 404,
  "data": "Not Found",
  "url": "https://api.example.com/missing",
  "method": "GET"
}

HTTP Status Codes

StatusMeaningAction
200-299SuccessProcess the response data
400Bad RequestCheck request parameters
401UnauthorizedCheck API key/authentication
403ForbiddenInsufficient permissions
404Not FoundCheck URL path
429Too Many RequestsRate limited, wait and retry
500-599Server ErrorExternal service issue

Use Cases

Use CaseMethodDescription
Fetch dataGETRetrieve resources
Create resourcePOSTAdd new data
Update resourcePUT/PATCHModify existing data
Delete resourceDELETERemove data
Health checkGETVerify service availability
Webhook triggerPOSTSend events to services

Guidelines

  1. URLs: Must be fully qualified with protocol (https://)
  2. Authentication: Use node headers for API keys/tokens
  3. Timeout: Default 30 seconds
  4. JSON body: Automatically serialized for POST/PUT/PATCH
  5. Response: JSON responses are automatically parsed

Security Notes

  1. Never expose API keys in responses to users
  2. Validate URLs before making requests
  3. Avoid internal/private network addresses (localhost, 192.168.x.x)
  4. Respect rate limits of external services
  5. Don't store sensitive data from API responses

Setup Requirements

  1. Connect the HTTP Request node to Zeenie's input-tools handle
  2. Configure authentication headers on the node if needed
  3. Ensure network access to target APIs