Skip to main content

Create Report

This endpoint is used to create a new report by providing the necessary data and configuration details.

  POST https://api.letpay.io/myreports/

Request description

  • name: (required/string) - The name of the report.
  • folder: (optional/string) - Specifies the folder where the report will be saved.
  • report_type: (required/string) - Indicates the type of the report.
  • enable: (required/boolean) - Determines whether the report is enabled or disabled.
  • fields: (required/array[object]) - The fields of the report.
    • field: (required/object) - Represents the field obtained from the fields query.
      • id: (required/int) - The unique identifier of the field.
      • position: (required/int) - Specifies the position of the field in the report.
      • alias: (required/string) - Defines the title of the field in the report.
      • open_parentheses: (required/boolean) - Indicates whether to open a parenthesis for an arithmetic operation.
      • close_parentheses: (required/boolean) - Indicates whether to close the parenthesis of an arithmetic operation.
      • arithmetic_operator: (optional/string) - Specifies the arithmetic operator that comes after the field.
      • aggregation_operator: (optional/string) - Specifies the aggregation operator applied to the field.
      • wrap: (string) - Defines the field envelope, allowing result formatting.
  • filters: (required/array[object]) - The filters of the report.
    • field: (required/object) - Represents the field obtained from the fields query.
      • id: (required/int) - The unique identifier of the field.
      • position: (required/int) - Specifies the order in which the filter will be executed in the report.
      • filter_operator: (required/string) - Specifies the operator used in the filter.
      • logical_operator: (optional/string) - Specifies the connection between two filters, which can be AND or OR. If not specified, it defaults to AND.
      • value: (required/string) - The value of the filter.
      • dynamic_filter: (optional/boolean) - Indicates whether the filter value is dynamic, allowing the use of values returned for this field in the fields query.
  • group_by: (optional/array[string]) - Specifies how the report should be grouped using field aliases. This is mandatory when any field has an aggregation operator.
  • order_by: (required/array[object]) - Defines how the report will be ordered.
    • position: (required/int) - Indicates the position of the order in the report.
    • field_position: (required/int) - Indicates the position of the field used in the order.
    • direction: (required/string) - Specifies how the field should be ordered, which can be ASC or DESC.
  • limit: (optional/int) - Limits the number of records returned by the report.
  • offset: (optional/int) - Used in combination with limit to define the pagination of the report.

The values provided for arithmetic_operator, aggregation_operator, wrap, filter_operator, and value (when dynamic_filter is enabled) must match one of the values returned for these fields in the respective get fields query.

Authorization

AUTHORIZATIONAPI Key
KeyX-Auth-Token
ValueMY_ACCESS_TOKEN

Body Raw(json)

json
{
"id": null,
"name": "Report Tabelando",
"folder": "default",
"report_type": "PAYIN",
"enable": true,
"fields": [
{
"position": 1,
"pid": 1738065040133,
"alias": "TransactionStatus",
"table": "Payment",
"aggregation_operator": null,
"arithmetic_operator": null,
"wrap": null,
"open_parentheses": false,
"close_parentheses": false,
"field": {
"id": "65"
}
}
],
"filters": [
{
"position": 1,
"pid": 1738065040136,
"table": "Payment",
"filter_operator": "IN",
"logical_operator": "AND",
"data_type": "VARCHAR",
"value": "PAID",
"field": {
"id": "52"
}
}
],
"group_by": [],
"order_by": [
{
"position": 1,
"field_position": 1,
"direction": "ASC"
}
],
"limit": null,
"offset": 0
}