GET /api/report_templates
列出所有报告模块

GET /api/locations/:location_id/report_templates
列出每个位置的报告模板

GET /api/organizations/:organization_id/report_templates
列出每个机构的所有报告模板

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

search
选填

过滤结果

Validations:

  • Must be a String

order
选填

排序项和顺序,例如 ‘id DESC’

Validations:

  • Must be a String

page
选填

页号,从 1 开始

Validations:

  • Must be a number.

per_page
选填

每页中显示的返回结果数

Validations:

  • Must be a number.

搜索字段

字段名 类型 可能的值
default true, false
location
location_id
locked true, false
name
organization
organization_id
snippet true, false
template

GET /api/report_templates/:id
显示一个报告模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/report_templates
创建一个报告模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

report_template
必填

Validations:

  • Must be a Hash

report_template[name]
必填

Validations:

  • Must be a String

report_template[description]
选填 , 允许空值

Validations:

  • Must be a String

report_template[template]
必填

Validations:

  • Must be a String

report_template[snippet]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

report_template[audit_comment]
选填 , 允许空值

Validations:

  • Must be a String

report_template[locked]
选填 , 允许空值

是否已锁定该模板进行编辑

Validations:

  • Must be one of: true, false, 1, 0.

report_template[default]
选填 , 允许空值

模板是否会自动添加到新的机构和位置

Validations:

  • Must be one of: true, false, 1, 0.

report_template[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

report_template[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


POST /api/report_templates/import
导入一个报告模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

report_template
必填

Validations:

  • Must be a Hash

report_template[name]
选填

模板名称

Validations:

  • Must be a String

report_template[template]
选填

包括元数据的模板内容

Validations:

  • Must be a String

report_template[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

report_template[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type

options
选填

Validations:

  • Must be a Hash

options[force]
选填 , 允许空值

在您希望更新锁定的模板时使用

Validations:

  • Must be one of: true, false, 1, 0.

options[associate]
选填 , 允许空值

确定模板何时应基于元数据关联对象,new 表示只在创建新模板时,always 表示同时适用于新模板和的只进行更新的现有模板,never 表示忽略元数据

Validations:

  • Must be one of: new, always, never.

options[lock]
选填 , 允许空值

锁定导入的模板(默认为 false)

Validations:

  • Must be one of: true, false, 1, 0.

options[default]
选填 , 允许空值

把模块设为默认意味着它将自动与新创建的组织和位置相关联(默认为 false)

Validations:

  • Must be one of: true, false, 1, 0.


GET /api/report_templates/revision

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

version
选填

模板版本

Validations:

  • Must be a String


PUT /api/report_templates/:id
更新一个报告模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String

report_template
必填

Validations:

  • Must be a Hash

report_template[name]
选填

Validations:

  • Must be a String

report_template[description]
选填 , 允许空值

Validations:

  • Must be a String

report_template[template]
选填

Validations:

  • Must be a String

report_template[snippet]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

report_template[audit_comment]
选填 , 允许空值

Validations:

  • Must be a String

report_template[locked]
选填 , 允许空值

是否已锁定该模板进行编辑

Validations:

  • Must be one of: true, false, 1, 0.

report_template[default]
选填 , 允许空值

模板是否会自动添加到新的机构和位置

Validations:

  • Must be one of: true, false, 1, 0.

report_template[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

report_template[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


DELETE /api/report_templates/:id
删除一个报告模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String


POST /api/report_templates/:id/clone
克隆模板

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

report_template
必填

Validations:

  • Must be a Hash

report_template[name]
必填

模板名称

Validations:

  • Must be a String


GET /api/report_templates/:id/export
导出一个报告模板到 ERB

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/report_templates/:id/generate
Generate report from a template

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

input_values
选填

哈希输入值,其中关键字是输入名称,值是这个输入

Validations:

  • Must be a Hash

gzip
选填

Compress the report uzing gzip

Validations:

  • Must be one of: true, false, 1, 0.

report_format
选填

Report format, defaults to 'csv'

Validations:

  • Must be one of: csv, json, yaml, html.


POST /api/report_templates/:id/schedule_report
Schedule generating of a report

The reports are generated asynchronously. If mail_to is not given, action returns an url to get resulting report from (see report_data).

示例

POST /api/report_templates/:id/schedule_report/
200
{
  "job_id": UNIQUE-REPORT-GENERATING-JOB-UUID
  "data_url": "/api/v2/report_templates/1/report_data/UNIQUE-REPORT-GENERATING-JOB-UUID"
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

input_values
选填

哈希输入值,其中关键字是输入名称,值是这个输入

Validations:

  • Must be a Hash

gzip
选填

Compress the report using gzip

Validations:

  • Must be one of: true, false, 1, 0.

mail_to
选填

If set, scheduled report will be delivered via e-mail. Use ',' to separate multiple email addresses.

Validations:

  • Must be a String

generate_at
选填

UTC time to generate report at

Validations:

  • Must be a String

report_format
选填

Report format, defaults to 'csv'

Validations:

  • Must be one of: csv, json, yaml, html.


GET /api/report_templates/:id/report_data/:job_id
Downloads a generated report

Returns the report data as a raw response. In case the report hasn't been generated yet, it will return an empty response with http status 204 - NoContent.

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

job_id
必填

ID assigned to generating job by the schedule command

Validations:

  • Must be a String