googleads / googleads-dfa-reporting-samples

Samples for the DoubleClick for Advertisers Reporting and Trafficking API
Apache License 2.0
106 stars 173 forks source link

Setting read-only field Id for Size Object in CreatePlacement.java #23

Closed yougaindra closed 4 years ago

yougaindra commented 4 years ago

According to : https://developers.google.com/doubleclick-advertisers/v3.3/sizes#resource

ID of this size. This is a read-only, auto-generated field.

but in CreatePlacement.java, it is being set

Size size = new Size();
size.setId(sizeId);

Is this required? If yes Why?

jimper commented 4 years ago

Hey there,

You're right, that ID is read-only. But that only applies when you're inserting, patching, or updating a Size object.

The CreatePlacement example isn't inserting a new Size or update an existing one. What that code is doing is creating a reference an existing Size object. If you wanted, you could retrieve the existing object by calling either Sizes.get() or Sizes.list() and use that instead.

- Jonathon Imperiosi