声明式参数(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 中呈现,以便用户在后续查询中使用它们。该对象必须包括用于查询服务的路由信息,以及定义如何处理返回选项的输出设置。例如:
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 调用的详细信息。
下面的代码示例来自声明式风格教程。它展示了如何与 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 支持两种节点版本管理方法,但声明式节点必须使用轻量版本管理方法。更多信息请参阅 节点版本管理。
🌐 n8n supports two methods of node versioning, but declarative-style nodes must use the light versioning approach. Refer to Node versioning for more information.