8.6. 使用 Satellite API 导入报告模板
您可以使用 Satellite API 将报告模板导入到 Satellite。使用 Satellite API 导入报告模板会自动解析报告模板元数据并分配组织和位置。有关使用 Satellite API 的更多信息,请参阅 API 指南。
前提条件
使用
.erb
语法创建模板,或者从另一个卫星导出模板。有关编写模板的更多信息,请参阅 附录 A, 模板编写参考。
有关从 Satellite 导出模板的更多信息,请参阅 第 8.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