This article covers differences between v2 and v3 of the AdSense API. For solutions to frequently encountered migration issues, see the AdSense API v3 Migration Issues article. You can also find sample code for new and changed operations on the v3 Sample Code page.
The following changes affect all AdSense API web services:
Version 3 services are located at a different URL. To access them, change your endpoints to the following URL:
https://google.com/api/adsense/v3/SERVICE_NAME
In addition to the new endpoint URLs, v3 uses a different XML namespace:
http://www.google.com/api/adsense/v3
Changes to the AdSense API back-end have altered the way that enumerated types are specified. (Enumerated types are shown in the Developer Guide as a constrained set of values.) In v3, enumerated types in parameters and response objects are represented by a string enclosed in a <value/> element.
In v2, you specified an enumerated parameter with the following XML:
<adUnitType>TextOnly</adUnitType>
In v3, you enclose the enumerated value in a <value/> element, as shown below:
<adUnitType><value>TextOnly</value></adUnitType>
For a list of all enumerated types in AdSense API, see the Appendix.
Use these tips to migrate your code that accesses AccountService.
createAccount acccepts a new parameter (developerUrl) and removes hasAcceptedTCs.
associateAccount also accepts developerUrl.
Caution: Even though createAdSenseAccount and associateExistingAccount are still available in v3, these requests have been deprecated and will be removed in a future version of the API.
generateAdCode now accepts two new parameters:
The corner style that should be used for the requested ad unit
The AFC host channel that should be used to track statistics for this page.
This appendix lists all enumerated types in AdSense API. To migrate to v3, you will need to modify your code to handle the enclosing <value/> element, as described in the General Changes section.
Tip: Frequently used requests are highlighted in the tables below.
| Enumerated Type | Used in these requests: | Used in these data objects: |
|---|---|---|
ApprovalStatus |
getApprovalStatus | PublisherApprovalStatus |
EntityType |
|
(none) |
MpmStatus |
getAssociationStatus | PublisherAssociationStatus |
SyndicationService_Type |
|
SyndicationService_Data |
| Enumerated Type | Used in these requests: | Used in these data objects: |
|---|---|---|
AdLayout |
|
(none) |
AdUnitType |
|
(none) |
ChannelService_Type |
|
(none) |
CornerStyles |
generateAdCode | (none) |
| Enumerated Type | Used in these requests: | Used in these data objects: |
|---|---|---|
ChannelService_Type |
getChannels | ChannelService_Data |
ChannelService_Status |
getChannels | ChannelService_Data |
LogoPlacement |
|
SearchResultStyle |
LogoType |
generateSearchBoxCode | SearchBoxStyle |
SearchType | ,
generateSearchBoxCode |
| Enumerated Type | Used in these requests: | Used in these data objects: |
|---|---|---|
ChannelService_Status |
|
ChannelService_Data |
ChannelService_Type |
|
ChannelService_Data |
SyndicationService_Type |
getSyndicationService | SyndicationService_Data |
| Enumerated Type | Used in these requests: | Used in these data objects: |
|---|---|---|
Grouping |
generateReport |
|
PredefinedDateRange |
generateReport | DateRange |
OutputFormat |
generateReport | (all Report types) |
Unit |
generateReport |
|
SiteFilterService does not use any enumerated types.