Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a statement with importDateTime query #197

Open
anacarolinacastro opened this issue May 13, 2024 · 0 comments
Open

Build a statement with importDateTime query #197

anacarolinacastro opened this issue May 13, 2024 · 0 comments

Comments

@anacarolinacastro
Copy link

Hello,

I am trying to create a code routine that will clean old content.

To do so, I want to use a statement to list the content objects that have importDateTime older than months. Is there a way to query this field? I am currently getting the following exception:

[...]
irb(main):241:0> limit_import_date_time = ad_manager.now('America/New_York') - 6.months
irb(main):242:1* statement = ad_manager.new_statement_builder do |sb|
irb(main):243:1*     sb.where = "contentSourceId = :content_source_id AND status = :status AND importDateTime < :import_date_time"
irb(main):244:1*     sb.with_bind_variable("status", "ACTIVE")
irb(main):245:1*     sb.with_bind_variable("content_source_id", "2647737")
irb(main):246:1*     sb.with_bind_variable("import_date_time", limit_import_date_time)
irb(main):247:0> end
=> 
#<AdManagerApi::StatementBuilder:0x00007d66ee99a2f0
...
irb(main):248:0> page = ad_manager.service(:ContentService, :v202311).get_content_by_statement(statement.to_statement)
/usr/local/bundle/gems/google-ads-common-1.0.3/lib/ads_common/savon_service.rb:121:in `handle_errors': 

[PublisherQueryLanguageContextError.UNEXECUTABLE @ ] (AdManagerApi::V202311::ContentService::ApiException)

By the API docs, the field importDateTime seems like a valid readable attribute.

Thanks.

@anacarolinacastro anacarolinacastro changed the title Build a statement with Build a statement with importDateTime query May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant