I am using
https://github.com/googleads/googleads-dfa-reporting-samples/blob/master/java/v2.8/src/main/java/com/google/api/services/samples/dfareporting/creatives/CreateInstreamVideoCreative.java as a guide to create in-stream video creative.
If I add
creative.setActive(true);, I get an error saying "message" : "8157 : An active video creative must have at least one serving file set to include in serving."
If I set active=false, I can create the creative but cannot create an (RotationGroup) and link it to a placement. Error message is "At least one active creative must be assigned to any active ad. Also,
the creative must have \"Include in rotation\" set to \"Yes\" in your ad
properties"
I cannot find any method that allows me to set serving files to the creative. So I attempt to update the active=true with a patch request after I create the creative. .
Creative creative = new Creative();
creative.setAdvertiserId(advertiserId);
creative.setName(assetName);
creative.setType("INSTREAM_VIDEO");
creative.setActive(false);
// Upload the video asset
CreativeAssetId videoAssetId = uploadAsset(reporting, profileId, advertiserId, assetName, assetPath, "VIDEO").getAssetIdentifier();
CreativeAsset videoAsset = new CreativeAsset().setAssetIdentifier(videoAssetId).setRole("PARENT_VIDEO");
// Add the creative assets.
creative.setCreativeAssets(ImmutableList.of(videoAsset));
Creative result = reporting.creatives().insert(profileId, creative).execute();
// Update active to true. This only works if I delay the request call for a while.
Creative requestBody = new Creative();
requestBody.setActive(true);
Dfareporting.Creatives.Patch request = reporting.creatives().patch(profileId, result.getId(), requestBody);
This unfortunately still doesn't work. I am guessing it takes some time for DCM to process the videos and make them available as serving files.
How do I create an active in-stream video creative so I can create an ad and link it to a placement?
Thanks.