跳转到主要内容
Vantage API 允许你访问 Document skill 和 Process 技能的参数,并为特定的处理事务更改其值。在处理事务中传递的 Skill 参数以键值 string 对的形式提供。 对于 Document 和 Process 技能的参数,通过 Vantage API 设置的值将优先于通过 Vantage UI 设置的值。

更改 Skill Parameter 值

要通过 Vantage API 更改 Skill Parameter 的值,请按以下步骤操作:

步骤 1:创建或初始化事务(Transaction)

创建一个空的处理事务,或使用 launch 方法初始化处理事务。为此,向 transactions 资源发送一个 POST 请求:
POST {your-host}/api/publicapi/v1/transactions
POST {your-host}/api/publicapi/v1/transactions/launch?skillId={skill-id}
在请求正文中为该 Skill 的 Parameter 指定新值,然后运行以下命令:

Windows 示例

curl -X POST "{your-host}/api/publicapi/v1/transactions" ^
-H "Authorization: Bearer {token}" ^
-H "Content-Type: application/json" ^
-d "{\"skillId\":\"123\",\"skillParameters\":[{\"key\":\"New parameter\",\"value\":\"Vendors new\"}]}"

Linux 示例

curl -X POST '{your-host}/api/publicapi/v1/transactions' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-d '{"skillId":"123","skillParameters":[{"key":"New parameter","value":"Vendors new"}]}'
**注意:**最多可包含 10 个键值对的 Skill Parameter,每个键最多包含 128 个字符,每个值最多包含 256 个字符。

获取 Skill Parameter 值

要通过 Vantage API 获取 Skill 的 Parameter 值,请执行以下任一操作:

选项 1:直接获取 Skill Parameters

transactions/{transaction-id}/skillParameters 资源发送 GET 请求:
GET {your-host}/api/publicapi/v1/transactions/{transaction-id}/skillParameters/
响应将类似如下:
[
  {
    "key": "新 Parameter",
    "value": "Vendors"
  }
]

选项 2:下载事务(Transaction)文件

transactions/{transaction-id}/files/{file-id}/download 资源发送 GET 请求,以 JSON 格式获取其值:
GET {your-host}/api/publicapi/v1/transactions/{transaction-id}/files/{file-id}/download