Create Report
POST https://api.letpay.io/myreports/report
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
| AUTHORIZATION | API Key |
|---|---|
| Key | X-Auth-Token |
| Value | MY_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
}
Example Request
- 201 - Created
- 401 - Unauthorized
- 400 - Bad Request
Example Request
201 - Created
curl --location -g 'https://api.letpay.io/myreports/report' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--data '{
"name": "Payment of last 7 days",
"folder": "financeiro",
"report_type": "PAYIN",
"enable": true,
"fields": [
{
"position": 1,
"alias": "Amount",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 1
}
},
{
"position": 2,
"alias": "Channel",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 56
}
}
],
"filters": [
{
"position": 1,
"field": {
"id": 3
},
"dynamic_filter": "true",
"filter_operator": ">=",
"value": "LAST_7_DAYS"
},
{
"position": 2,
"field": {
"id": 3
},
"dynamic_filter": "true",
"filter_operator": "<",
"value": "CURRENT_DAY"
}
],
"group_by": [],
"order_by": [
{
"position": 1,
"field_position": 1,
"direction": "ASC"
}
]
}'
Example Response
Header
Content-Type: application/json
Body
{
"id": 198,
"name": "Payment of last 7 days",
"folder": "financeiro",
"report_type": "PAYIN",
"enable": true,
"offset": null,
"limit": null,
"fields": [
{
"field": {
"id": 1
},
"id": 124,
"position": 1,
"alias": "Amount",
"aggregation_operator": null,
"arithmetic_operator": null,
"wrap": null,
"open_parentheses": false,
"close_parentheses": false
},
{
"field": {
"id": 56
},
"id": 125,
"position": 2,
"alias": "Channel",
"aggregation_operator": null,
"arithmetic_operator": null,
"wrap": null,
"open_parentheses": false,
"close_parentheses": false
}
],
"filters": [
{
"field": {
"id": 3
},
"id": 81,
"position": 2,
"filter_operator": "<",
"value": "CURRENT_DAY",
"logical_operator": "AND",
"dynamic_filter": true
},
{
"field": {
"id": 3
},
"id": 82,
"position": 1,
"filter_operator": ">=",
"value": "LAST_7_DAYS",
"logical_operator": "AND",
"dynamic_filter": true
}
],
"group_by": [
""
],
"order_by": [
{
"id": 59,
"position": 1,
"field_position": 1,
"direction": "ASC"
}
],
"report_type_name": "Payin"
}
Example Request
401 - Unauthorized
curl --location -g 'https://api.letpay.io/myreports/report' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--data '{
"name": "Payment of last 7 days",
"folder": "financeiro",
"report_type": "PAYIN",
"enable": true,
"fields": [
{
"position": 1,
"alias": "Amount",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 1
}
},
{
"position": 2,
"alias": "Channel",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 56
}
}
],
"filters": [
{
"position": 1,
"field": {
"id": 3
},
"dynamic_filter": "true",
"filter_operator": ">=",
"value": "LAST_7_DAYS"
},
{
"position": 2,
"field": {
"id": 345
},
"dynamic_filter": "true",
"filter_operator": "<",
"value": "CURRENT_DAY"
}
],
"group_by": [],
"order_by": [
{
"position": 1,
"field_position": 1,
"direction": "ASC"
}
]
}'
Example Response
Header
Content-Type: application/json
Body
{
"message": "Invalid or expired token",
"code": 0,
"details": {}
}
Example Request
400 - Bad Request
curl --location -g 'https://api.letpay.io/myreports/report' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--data '{
"name": "Payment of last 7 days",
"folder": "financeiro",
"report_type": "PAYIN",
"enable": true,
"fields": [
{
"position": 1,
"alias": "Amount",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 1
}
},
{
"position": 2,
"alias": "Channel",
"open_parentheses": "false",
"close_parentheses": "false",
"field": {
"id": 56
}
}
],
"filters": [
{
"position": 1,
"field": {
"id": 3
},
"dynamic_filter": "true",
"filter_operator": ">=",
"value": "LAST_7_DAYS"
},
{
"position": 2,
"field": {
"id": 345
},
"dynamic_filter": "true",
"filter_operator": "<",
"value": "CURRENT_DAY"
}
],
"group_by": [],
"order_by": [
{
"position": 1,
"field_position": 1,
"direction": "ASC"
}
]
}'
Example Response
Header
Content-Type: application/json
Body
{
"message": "Validation error",
"code": 0,
"details": {
"filters[0].filterOperator": "não deve ser nulo"
}
}