Error while posting to report_queue

Posted in General by bt-mis-dev Wed Oct 03 2018 06:39:29 GMT+0000 (Coordinated Universal Time)·3·Viewed 311 times

We need to download a report on a daily bases of the last 14 days (the report configuration doesn’t change every day). So I tried a couple of options: 1) Create a report manually with the UI and then doing post calls to ‘report_queue’ with the report_id to get the report – didn’t work because I get errors that some of the fields “not a valid field for this report” although I added them to the report. 2) Create the report with a post call to ‘report_save’ and then post calls to ‘report_queue’ to get the report – doesn’t work because I get this error: When we create a report with a post call to 'rest/report_save' with the following json: '{"report_id":1, "report_name":"Daily report", "request_details":{"field":["day_performance","line_item_name"], "metric":["impression"], "filter": [{"bid_hour": "last_14_days"}]}, "report_format":"csv"}' we get a report id: '{ "success": true, "payload": { "id": 17 }, "message": "report_queue created with ID = 17" }' but when we make a post call to 'rest/report_queue' with the following json: '{"report_id":17, "report_name":"Daily report", "report_format":"csv"}' we get this error: '{ "success": false, "message": "report_queue could not be created", "errors": [ "ERROR: Report id 17 does not exist" ] }' Is this the right way to achieve what we need? Thanks,
Oct 3, 2018

The report_save endpoint allows you to create a report definition that is then automatically emailed to you daily or monthly. Once you save a report, there is no further need to use the API to have it sent to you.

It seems that what you want to do is to have an API call you control create a new report and download the contents on a schedule you control. To do this, use the report_queue endpoint in two steps:

First, POST the report definition to the end point. If the request is successful, a report_queue_id will be returned.

Then make a GET request to the report_queue endpoint, passing the report_queue_id. See this page of the documentation for an example:

https://docs.beeswax.com/docs/report_queue-1

Oct 3, 2018

Hi

OK, this is what we need, I just thought that the report_id needs to reflect an existing saved report
if this is the case than it makes 'report_id' kinda obsolete in the report_queue object, no?

Any way many Thanks :)

Oct 3, 2018

report_id refers to the type of report you are requesting. For example, the performance_report is report_id 1. See this article for more details:

https://docs.beeswax.com/docs/reporting

  
Markdown is allowed