1Shot API icon

1Shot API

Interact with EVM blockchains via 1Shot API

X402 Request → X402 HTTP Request

AI-generated

Overview

The X402 HTTP Request operation in the 1Shot API node allows users to make customizable HTTP requests to any URL with various authentication methods, query parameters, headers, and body content types. It supports different HTTP methods like GET, POST, PUT, DELETE, etc., and can handle complex request configurations including SSL certificates, batching, redirects, and response handling. This operation is useful for integrating with external APIs or services that require flexible HTTP requests, such as calling REST APIs, sending data to webhooks, or fetching data from web resources.

Use Case Examples

  1. Sending a GET request to retrieve data from a public API with optional query parameters and headers.
  2. Making a POST request with JSON body content to submit data to a service requiring OAuth2 authentication.
  3. Uploading a binary file using multipart-form-data content type to an endpoint.
  4. Handling paginated API responses by batching requests and processing each batch sequentially.

Properties

Name Meaning
Wallet Name or ID Select or specify the wallet to use for the request authentication or signing.
Method The HTTP method to use for the request, such as GET, POST, PUT, DELETE, etc.
URL The URL to which the HTTP request will be sent.
Authentication The authentication method to use for the request, including none, predefined credential types, or generic credential types.
Credential Type The specific credential type to use when predefined authentication is selected.
Generic Auth Type The specific generic authentication type to use when generic authentication is selected.
SSL Certificates Whether to provide SSL certificates for the request.
Send Query Parameters Whether to include query parameters in the request URL.
Specify Query Parameters How to specify query parameters, either using key-value pairs or JSON.
Query Parameters The key-value pairs for query parameters if specified using fields.
JSON Query The JSON object for query parameters if specified using JSON.
Send Headers Whether to include headers in the request.
Specify Headers How to specify headers, either using key-value pairs or JSON.
Header Parameters The key-value pairs for headers if specified using fields.
JSON Headers The JSON object for headers if specified using JSON.
Send Body Whether to include a body in the request.
Body Content Type The content type of the request body, such as JSON, form-data, raw, binary, etc.
Specify Body How to specify the body content, either using key-value pairs, JSON, or raw string depending on content type.
Body Parameters The key-value pairs or binary data fields for the body content if specified using fields.
Body The raw string body content if specified as a single field or raw content type.
Input Data Field Name The name of the incoming binary data field to use as the request body if content type is binary.
Content Type The content type header for raw body content.
Options Additional options for the request such as batching, SSL validation, redirects, response handling, timeout, and header casing.
Optimize Response Whether to optimize the response data to reduce the amount of data passed to downstream processing.
Expected Response Type The expected type of response data when optimizing response, such as JSON, HTML, or text.
Field Containing Data The field name in the response containing the main data when optimizing response.
Include Fields Which fields to include or exclude in the optimized response.
Fields Comma-separated list of fields to include or exclude in the optimized response.
Selector (CSS) CSS selector to extract specific elements from HTML response when optimizing.
Return Only Content Whether to return only the content of HTML elements, stripping tags and attributes.
Elements To Omit CSS selectors of elements to omit when extracting content from HTML response.
Truncate Response Whether to truncate the response text or HTML to save tokens.
Max Response Characters Maximum number of characters to keep in the truncated response.

Output

JSON

  • body - The body of the HTTP response, which can be JSON, text, or binary data depending on the response format.
  • headers - The HTTP response headers.
  • statusCode - The HTTP status code returned by the server.
  • statusMessage - The HTTP status message returned by the server.

Dependencies

  • 1Shot API OAuth2 credential for authentication

Troubleshooting

  • Invalid URL error if the URL does not start with http:// or https://.
  • Domain restriction errors if the credential restricts allowed domains and the URL is not in the allowed list.
  • JSON parsing errors if JSON input fields are not valid JSON strings.
  • HTTP 402 Payment Required errors handled by automatic payment signature generation and retry.
  • Batching settings to avoid rate limiting by spacing out requests.
  • Errors related to unsupported operations or resources if parameters are incorrect.

Discussion