Overview
This node integrates with the Xiaohongshu (Little Red Book) API, enabling users to interact programmatically with various Xiaohongshu services. It supports multiple API categories and operations, allowing flexible access to different endpoints such as searching notes or users, retrieving note details, comments, user information, and more.
Common scenarios include:
- Automating data retrieval from Xiaohongshu for analytics or content aggregation.
- Searching for notes or users based on keywords and filters.
- Fetching detailed information about specific notes or users.
- Managing comments and sub-comments on notes.
Practical example:
- A marketing team could use this node to automatically search for trending notes related to a product category and analyze user engagement.
- A developer might fetch user profiles and their posted notes to build a custom dashboard.
Properties
| Name | Meaning |
|---|---|
| API 分类 | Select the API category to specify which group of Xiaohongshu APIs to use. Categories are dynamically loaded. |
| 使用预设参数 | Boolean flag to decide whether to use preset parameter templates for the selected API operation. If true, the node uses predefined parameters; if false, manual HTTP request configuration is enabled. |
| 请求方法 | HTTP method for the request when not using preset parameters. Options: GET, POST, PUT, DELETE. |
| URL | The URL path of the API endpoint when not using preset parameters. Example placeholder: /api/sns/web/v1/search/notes. |
| 查询参数 | Collection of query parameters (name-value pairs) to include in GET requests when not using preset parameters. |
| 请求体 | JSON-formatted request body for POST or PUT requests when not using preset parameters. |
| 响应格式 | Expected response format from the API. Options: JSON, Text, Auto-detect. |
| 完整响应 | Boolean flag indicating whether to return the full HTTP response including status code and headers, or just the response body. |
Additional properties appear dynamically depending on the selected operation and whether preset parameters are used, such as:
- 关键词 (keyword): Search keyword for certain operations.
- 页码 (page), 每页数量 (page_size): Pagination controls.
- 笔记ID (note_id), 笔记链接 (note_url): Identifiers or URLs for notes.
- 用户链接 (user_url), 用户ID (user_id): Identifiers or URLs for users.
- 安全令牌 (xsec_token): Security token parsed from URLs or provided manually.
- 游标 (cursor), 数量 (num): For pagination and limiting results.
- 排序方式 (sort), 内容类别 (note_type): Sorting and filtering options for search results.
- 顶部评论ID (top_comment_id), 根评论ID (root_comment_id): For fetching specific comment threads.
Output
The node outputs an array of items where each item contains a json field with the API response data. The structure of the JSON depends on the specific API operation called but generally includes:
- The main data returned by the Xiaohongshu API (e.g., search results, note details, user info).
- An internal
_metaobject appended to each output containing:operation: The name of the executed operation.category: The API category used.method: HTTP method used.url: The full URL path requested.timestamp: ISO timestamp of when the request was made.
If the "完整响应" (fullResponse) option is enabled, the output includes the full HTTP response details such as status code and headers alongside the body.
The node does not output binary data.
Dependencies
- Requires an API authentication credential (referred generically as an API cookie or token) to authenticate requests to Xiaohongshu.
- Uses internal helper functions (
getApiCategories,getApisByCategory,getOperationDetails,xiaohongshuApiRequest) to load API metadata and perform HTTP requests. - No external environment variables are explicitly required beyond the configured API credential.
Troubleshooting
Error: "未找到操作" (Operation not found)
Occurs if the specified operation does not exist within the selected category. Verify that the correct category and operation are chosen.Error: "请求体 JSON 格式错误" (Request body JSON format error)
Happens when the JSON entered in the request body is invalid. Ensure the JSON syntax is correct.API Request Failures
Could be due to invalid or expired API credentials, network issues, or incorrect parameters. Check the API key/token validity and network connectivity.Dynamic Value Replacement Issues
When using dynamic expressions in URL or parameters, ensure referenced input data fields exist and are correctly formatted.Using Preset Parameters vs Manual Configuration
If unexpected errors occur, try toggling the "使用预设参数" option to switch between automatic parameter handling and manual HTTP request setup.
Links and References
- Xiaohongshu Official Website
- n8n Documentation on Creating Custom Nodes: https://docs.n8n.io/integrations/creating-nodes/
- General REST API Concepts: https://restfulapi.net/
(Note: Specific Xiaohongshu API documentation links are not included as they are not present in the source code.)