10.6. 使用 Satellite API 导入报告模板
您可以使用 Satellite API 将报告模板导入到 Satellite。使用 Satellite API 导入报告模板会自动解析报告模板元数据并分配机构和位置。有关使用 Satellite API 的更多信息,请参阅 API 指南。
先决条件
使用
.erb
语法创建模板,或者从另一个 Satellite 导出模板。有关编写模板的更多信息,请参阅 附录 A, 编写参考的模板。
有关从 Satellite 导出模板的更多信息,请参阅 第 10.4 节 “使用 Satellite API 导出报告模板”。
流程
使用以下示例格式化您要导入到
.json
文件的模板:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 带有 ERB 模板的 JSON 文件示例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用以下请求导入模板:
curl --insecure --user admin:redhat \ --data @Example_Template.json --header "Content-Type:application/json" \ --request POST --config https://satellite.example.com/api/report_templates/import
$ curl --insecure --user admin:redhat \ --data @Example_Template.json --header "Content-Type:application/json" \ --request POST --config https://satellite.example.com/api/report_templates/import
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用以下请求来检索报告模板列表,并验证您可以在 Satellite 中查看模板:
curl --insecure --user admin:redhat \ --request GET --config https://satellite.example.com/api/report_templates | json_reformat
$ curl --insecure --user admin:redhat \ --request GET --config https://satellite.example.com/api/report_templates | json_reformat
Copy to Clipboard Copied! Toggle word wrap Toggle overflow