声明式参数#
¥Declarative-style parameters
以下是声明式节点 node 基础文件 可用的参数。
¥These are the parameters available for node base file of declarative-style nodes.
本文档提供了简短的代码片段,以帮助你理解代码结构和概念。有关构建节点的完整步骤(包括实际代码示例),请参阅 构建声明式风格节点。
¥This document gives short code snippets to help understand the code structure and concepts. For a full walk-through of building a node, including real-world code examples, refer to Build a declarative-style node.
有关所有节点可用的参数,请参阅 标准参数。
¥Refer to Standard parameters for parameters available to all nodes.
methods 和 loadOptions#
¥methods and loadOptions
对象 | 可选
¥Object | Optional
methods 包含 loadOptions 对象。你可以使用 loadOptions 查询服务以获取用户特定设置,然后返回这些设置并在 GUI 中呈现,以便用户可以在后续查询中包含这些设置。该对象必须包含查询服务的路由信息,以及定义如何处理返回选项的输出设置。例如:
¥methods contains the loadOptions object. You can use loadOptions to query the service to get user-specific settings, then return them and render them in the GUI so the user can include them in subsequent queries. The object must include routing information for how to query the service, and output settings that define how to handle the returned options. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
routing#
对象 | 必需
¥Object | Required
routing 是 options 数组中用于操作和输入字段对象的对象。它包含 API 调用的详细信息。
¥routing is an object used within an options array in operations and input field objects. It contains the details of an API call.
以下代码示例来自 声明式风格教程。它设置与 NASA API 的集成。它展示了如何使用 requestDefaults 设置基本的 API 调用详情,以及如何使用 routing 为每个操作添加信息。
¥The code example below comes from the Declarative-style tutorial. It sets up an integration with a NASA API. It shows how to use requestDefaults to set up the basic API call details, and routing to add information for each operation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
version#
数字或数组 | 可选
¥Number or Array | Optional
如果你只有一个节点版本,则可以使用版本号。如果你想支持多个版本,请将其转换为数组,其中包含每个节点版本的编号。
¥If you have one version of your node, this can be a number. If you want to support more than one version, turn this into an array, containing numbers for each node version.
n8n 支持两种 Node 版本控制方法,但声明式风格的节点必须使用轻量级版本控制方法。有关更多信息,请参阅 节点版本控制。
¥n8n supports two methods of node versioning, but declarative-style nodes must use the light versioning approach. Refer to Node versioning for more information.