getAudienceSegmentsByStatement throws SERVER ERROR when querying audience segments by id

126 views
Skip to first unread message

hchu...@spotify.com

unread,
Jan 9, 2018, 11:16:28 AM1/9/18
to Google's DoubleClick for Publishers API Forum
Hello,
   I am trying to query DFP Audience segments using getAudienceSegmentsByStatement as follows:

final StatementBuilder statementBuilder = new StatementBuilder()
.where("id in (:id)")
.limit(segmentIds.size())
.orderBy("id ASC")
.withBindVariableValue("id", Sets.newHashSet(segmentIds));

AudienceSegmentPage page = audienceSegmentService.getAudienceSegmentsByStatement(statementBuilder.toStatement());

But getAudienceSegmentsByStatement always fails with SERVER ERROR.

Things I have tried:
1. SegmentIds as a list of Longs - SERVER ERROR 
2  SegmentIds as a list of Strings - SERVER ERROR
3. Remove withBindVariableValue and hardcode the segmentIds in where clause: PASS

Any solution or workaround for this?

Thanks
Haresh

Message has been deleted

hchu...@spotify.com

unread,
Jan 9, 2018, 1:58:06 PM1/9/18
to Google's DoubleClick for Publishers API Forum
I also tried this:

for (Long segmentId : segmentIds) {
  StatementBuilder statementBuilder = new StatementBuilder()
    .where("id = :id")
.limit(segmentIds.size())
.withBindVariableValue("id", segmentId);

AudienceSegmentPage page = audienceSegmentService.
getAudienceSegmentsByStatement(statementBuilder.toStatement());

if (page.getResults() != null) {
Collections.addAll(segments, page.getResults());
  }    
}

This seems to work but will affect the response time as well as our org's dfp request quota per second.
But what comes out if there is probably a bug in the implementation of id in (:id) clause.

Nicholas Figeac (DFP API Team)

unread,
Jan 9, 2018, 3:38:20 PM1/9/18
to Google's DoubleClick for Publishers API Forum
Hello,

There is currently an issue with SetValue in Audience Segment Service. The current work around is to hardcode the ids like your third bullet point. Also, doing it that way will reduce it to one request unlike the request per id in the list of your last example.

Thanks,
Nicholas Figeac, DFP API Team

hchu...@spotify.com

unread,
Jan 10, 2018, 12:52:48 PM1/10/18
to Google's DoubleClick for Publishers API Forum
Ok, is there an open issue board where I can track if the issue was resolved?
Reply all
Reply to author
Forward
0 new messages