Use this endpoint to create a custom report.
Request
End Point https://business.newsbreak.com/business-api/v1/reports/createReport
Method POST
Header
| Field | Required | Data Type | Description |
|---|---|---|---|
| Access-Token | Y | string | Authorized access token. |
| Content-Type | Y | string | Request message type Allowed format: application/json. |
Request Parameters (case-sensitive)
| Field | Required | Data Type | Description |
|---|---|---|---|
| name | Y | string | Name of this report. |
| timezone | Y | string | Valid string representing timezone, such as UTC, America/Los_Angeles, Asia/Shanghai, etc. The default timezone is PDT. |
| dateRange | Y | enumerate |
FIXED, YESTERDAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS, MONTH_TO_DATE, QUARTER_TO_DATE, TODAY. |
| startDate | N | string | Start date of the report. It's required when dateRange=FIXED.Date should be formatted as "YYYY-mm-dd" like "2024-01-01". |
| endDate | N | string | End date of the report. It's required when dateRange=FIXED.Date should be formatted as "YYYY-mm-dd" like "2024-01-01". |
| filter | N | enumerate | Filter type. ORG,AD_ACCOUNT,CAMPAIGN,AD_SET,AD. |
| dataSource | N | enumerate | Data source type. HOURLY,REALTIME.Default as HOURLY.Hourly report is the official basis for income settlement on NewsBreak. |
| filterIds | N | list of int | IDs of filter. |
| dimensions | Y | list of string |
Dimensions. Available dimensions (UPPERCASE only): Date range restrictions apply: |
| metrics | Y | list of string | Available metrics (UPPERCASE only): COST, IMPRESSION, CLICK, CONVERSION, VALUE,CPM, CPC, CPA, CTR, CVR, VPA, COMPLETE_PAYMENT_ROAS, SALE_ROAS, APP_PURCHASE_ROAS, APP_IN_APP_AD_IMPR_ROAS. |
| eventMetrics | N | list of object |
Each object requires eventType and metrics. eventType is a string, represents the Event Type that you want to see report data of, eg. metrics is a list of string, represents the metrics of each eventType that you want to see report data of, |
Example
curl --location --request POST 'https://business.newsbreak.com/business-api/v1/reports/createReport' \
-H 'Content-Type: application/json' \
-H 'Access-Token:{{Access-Token}}' \
-d '{
"name": "my report example",
"timezone": "Asia/Shanghai",
"dateRange": "FIXED",
"startDate": "2024-01-01",
"endDate": "2024-01-01",
"filter": "AD_SET",
"dataSource": "REALTIME",
"filterIds": [
123456789
],
"dimensions": [
"DATE","AD_SET","AD"
],
"metrics": [
"COST","IMPRESSION"
],
"eventMetrics":[
{"eventType":"complete_payment","metrics":["COUNT","VALUE","CPA","VPA","CVR"]},
{"eventType":"app_in_app_ad_impr","metrics":["COUNT","VALUE","CPA","VPA","CVR"]}
]
}'
Response
Response Parameters
| Field | Data Type | Description |
|---|---|---|
| code | int | Status code, see Return Codes. |
| errMsg | string | Error message when code!=0. |
| data | string | ID of this report. |
Example
{
"code": 0,
"data": "123456789"
}