StevenMMortimer/rdfp

Saved queries

Closed this issue · 1 comments

Hi @ReportMort I see the same issue get by another user on stackoverflow.

I can pull queries from r studio if I create them manually, however I would like to be able to pull saved queries.

https://stackoverflow.com/questions/46476295/unable-to-pull-saved-query-from-google-dfp-using-r-studio

When the report in DFP UI has just one dimension works good, more than 1 dimensions the script has this error:

faultstring: [NotNullError.NULL @ reportJob.reportQuery]
errorString: NA
reason: NA
Error: api fault: [NotNullError.NULL @ reportJob.reportQuery]NANA

@cristianodalfarra I'm not sure the issue exists with Saved Queries having more than one dimension. I just ran one with 4 dimensions and it worked fine. I would suspect it is something to do with the query that you are passing isn't formatted correctly.

Example

> this_result <- dfp_getSavedQueriesByStatement(list(filterStatement=list(query="")), as_df=F)
> this_result$rval$results
$id
[1] "936165016"

$name
[1] "Advertiser Delivery Query"

$reportQuery
$reportQuery$dimensions
[1] "AD_UNIT_NAME"

$reportQuery$dimensions
[1] "ADVERTISER_NAME"

$reportQuery$dimensions
[1] "ORDER_NAME"
...

Then pass this over to again to get the refreshed results

this_report_query <- this_result$rval$results$reportQuery
report_request_data2 <- list(reportJob=list(reportQuery = this_report_query))
delivery_dat2 <- dfp_full_report_wrapper(report_request_data2)