v1.4 of the AdSense Management API is now deprecated. This version will stop returning data on October 12, 2021. Please migrate to v2 as soon as possible.

Method: accounts.adclients.getAdCode

accounts.get Auto ad code for a given ad client.

HTTP request

GET https://www.googleapis.com/adsense/v1.4/accounts/{accountId}/adclients/{adClientId}/adcode

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
accountId

string

Account which contains the ad client.

adClientId

string

Ad client to get the code for.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

JSON representation
{
  "kind": string,
  "adCode": string,
  "ampHead": string,
  "ampBody": string
}
Fields
kind

string

Kind this is, in this case adsense#adCode.

adCode

string

The Auto ad code snippet.

ampHead

string

The AMP Auto ad code snippet that goes in the head of an AMP page.

ampBody

string

The AMP Auto ad code snippet that goes in the body of an AMP page.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/adsense
  • https://www.googleapis.com/auth/adsense.readonly