Config API Version 2 PPC
Introduction
Infinity integrates with several paid search (PPC or pay-per-click) ad-serving networks.
To do so, we need to authenticate against the network’s own APIs with credentials and account references.
Each network has its own network code to identify it within Infinity, i.e.:
- gaw = Google AdWords
- mac = Bing Ads (formerly Microsoft AdCenter)
- ysm = Yahoo! Search Marketing (no longer active but available historically for some accounts)
Each account has a reference that identifies it within the network. They should also have a default time zone and currency defined within the network.
Authentication
Each account requires credentials in order to access its data. Those credentials can be either basic auth (a username and password) or oAuth2 (a refresh token).
For basic auth, the username and password can be submitted directly to the “add account” or “update account” routes.
For oAuth2, you must first create an auth session, use that session key to grant access to Infinity for the given client’s data, then finally submit the session key to the “add account” or “update account” route as appropriate.
The oAuth2 process is more complicated than basic auth but is considered more secure as the password and refresh token are kept private within each system.
Basic auth logins are being phased out by the networks in favour of oAuth2 over the next year or so. Once basic auth is phased out, only oAuth2 logins will be accepted by the paid search networks.
Oauth2 requires an appCode to identify the thirdparty system. Valid appCode’s for PPC network are googleAdwords and bingAds.
Status
This API uses Infinity status codes to show the state of each account within the network. Infinity status codes are mapped to network states as follows:
- 200 - active (running as normal)
- 204 - paused (paused by the client)
- 401 - unauthorised (credentials are no longer valid)
- 403 - unavailable (credentials are OK but do not give access to this account)
- 409 - suspended (e.g. due to lack of budget, or conflict with the network’s terms)
- 410 - disabled (no longer imported but kept for historical reporting)
List Networks
Lists known paid search networks.
Request:
GET /config/v2/ppc/networks
Filter Types
The networks list may be filtered by any of the returned fields.
Sort Types
The networks list may be sorted by any of the returned fields. By default the list is sorted by networkName.
Response:
Returns a list of known networks.
- networkCode (string) - Identifies the network.
- networkName (string) - The name of the network.
- oauth2AppCode (string) - The app code to use for oAuth2 requests, see Config V2 oAuth2.
Response example:
HTTP 200 - OK
{"networkCode":"mac","networkName":"Bing Ads","oauth2AppCode":"bingAds"}
{"networkCode":"gaw","networkName":"Google AdWords","oauth2AppCode":"googleAdWords"}
{"networkCode":"ysm","networkName":"Yahoo! Search Marketing","oauth2AppCode":""}
Read Network
Returns the properties for a particular network.
Request:
GET /config/v2/ppc/networks/{networkCode}
URL Path Params
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
Response:
Returns the requested network details.
- networkCode (string) - Identifies the network.
- networkName (string) - The name of the network.
- oauth2AppCode (string) - The app code to use for oAuth2 requests, see Config V2 oAuth2.
Response example:
HTTP 200 - OK
{"networkCode":"gaw","networkName":"Google AdWords","oauth2AppCode":"googleAdWords"}
List Available Accounts
Lists accounts available to add to an IGRP using a set of network credentials. One set of credentials should be provided, as either:
- The authSessionKey of an existing oAuth2 session
- A username and password for basic auth
- The reference of another account within the same IGRP and network. The credentials will be copied from this account.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/available
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
GET Params
- authSessionKey (string) OPTIONAL - Unique identifier for the auth session.
- authUsername (string) OPTIONAL - Login for the paid search network that has access to the required account.
- authPassword (string) OPTIONAL - The password that relates to username.
Response:
Returns a list of available network accounts using the provided credentials.
- networkCode (string) - The network code provided in the request.
- accountRef (string) - Identifies the account within the network.
- accountName (string) - The name of the account within the network.
Response example:
HTTP 200 - OK
{"networkCode":"gaw","accountRef":1234567890,"accountName":"Some Account"}
{"networkCode":"gaw","accountRef":9876543210,"accountName":"Other Account"}
List Accounts
Lists accounts added to an IGRP for a particular network.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”. You may also enter “all” as the networkCode to list accounts for all networks.
- filter (array) OPTIONAL - One or more filters.
- sort (array) OPTIONAL - One or more sorting params.
- limit (integer) OPTIONAL - limit on the result set.
- offset (integer) OPTIONAL - offset of the result set.
Filter Types
The accounts list may be filtered by any of the following fields.
- accountRef (string) - Identifies the account within the network.
- accountName (string) - The name of the account within the network.
- accountStatus (int) - The status of the account, see Status.
- currencyCode (string) - The three-letter ISO-4217 currency code that this account uses for reporting cost metrics.
- timezone (string) - The timezone that this account uses for reporting.
Sort Types
The accounts list may be sorted by any of the following fields. By default the list is sorted by accountName.
- accountRef (string) - Identifies the account within the network.
- accountName (string) - The name of the account within the network.
- accountStatus (int) - The status of the account, see Status.
- currencyCode (string) - The three-letter ISO-4217 currency code that this account uses for reporting cost metrics.
- timezone (string) - The timezone that this account uses for reporting.
Response:
Returns a list of accounts within the IGRP and network.
- igrp (int) - The IGRP provided in the request.
- networkCode (string) - The network code provided in the request.
- accountRef (string) - Identifies the account within the network.
- accountName (string) - The name of the account within the network.
- accountEmail (string) - The email address associated with the account.
- accountStatus (int) - The status of the account, see Status.
- currencyCode (string) - The three-letter ISO-4217 currency code that this account uses for reporting cost metrics.
- timezone (string) - The timezone that this account uses for reporting.
- lastSyncDatetime (datetime) - The last time (UTC) that Infinity checked the account for changes.
- maxBuildDatehour (datetime) - The latest date for which Infinity has imported this account’s metrics.
Response example:
HTTP 200 - OK
{"igrp":"1","networkCode":"gaw","accountRef":"1234567890","accountName":"My Account","accountStatus":"410","currencyCode":"GBP","timezone":"Europe\/London"}
{"igrp":"1","networkCode":"gaw","accountRef":"9876543210","accountName":"My Other Account","accountStatus":"200","currencyCode":"GBP","timezone":"Europe\/London","maxBuildDatehour":"2013-12-03 00:00:00","lastSyncDatetime":"2013-12-04 00:24:16"}
Read Account
Returns the properties for a particular account.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/{accountRef}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
- accountRef (string) - Identifies the account within the network.
Response:
Returns the requested account details.
- igrp (int) - The IGRP provided in the request.
- networkCode (string) - The network code provided in the request.
- accountRef (string) - Identifies the account within the network.
- accountName (string) - The name of the account within the network.
- accountEmail (string) - The email address associated with the account.
- accountStatus (int) - The status of the account, see Status.
- currencyCode (string) - The three-letter ISO-4217 currency code that this account uses for reporting cost metrics.
- timezone (string) - The timezone that this account uses for reporting.
- lastSyncDatetime (datetime) - The last time (UTC) that Infinity checked the account for changes.
- maxBuildDatehour (datetime) - The latest date for which Infinity has imported this account’s metrics.
Response example:
HTTP 200 - OK
{"igrp":"1","networkCode":"gaw","accountRef":"9876543210","accountName":"My Other Account","accountStatus":"200","currencyCode":"GBP","timezone":"Europe\/London","maxBuildDatehour":"2013-12-03 00:00:00","lastSyncDatetime":"2013-12-04 00:24:16"}
Add Account
Adds an account to an IGRP using a set of network credentials. One set of credentials should be provided, as either:
- The authSessionKey of an existing oAuth2 session
- A username and password for basic auth
- The reference of another account within the same IGRP and network. The credentials will be copied from this account.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
POST Params
- accountRef (string) - Identifies the account to add to the IGRP.
- authSessionKey (string) OPTIONAL - Unique identifier for the auth session.
- authUsername (string) OPTIONAL - Login for the paid search network that has access to the required account.
- authPassword (string) OPTIONAL - The password that relates to username.
- accountEmail (string) OPTIONAL - The email address associated with the account.
Response:
Returns the HTTP 204 (No Content) status code if added successfully.
HTTP 204 - NO CONTENT
Update Account
Updates the config for an existing account within an IGRP. Either the network credentials or the account’s status may be updated.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/{accountRef}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
- accountRef (string) - Identifies the account within the network.
POST Params
- authSessionKey (string) OPTIONAL - Unique identifier for the auth session.
- authUsername (string) OPTIONAL - Login for the paid search network that has access to the required account.
- authPassword (string) OPTIONAL - The password that relates to username.
- accountStatus (int) OPTIONAL - Infinity Status code indicating status of the account (e.g. 200).
- accountEmail (string) OPTIONAL - The email address associated with the account.
Response:
Returns the HTTP 204 (No Content) status code if update successful.
HTTP 204 - NO CONTENT
Delete Account
Deletes a particular account.
Request:
DELETE /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/{accountRef}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
- accountRef (string) - Identifies the account within the network.
Response:
Returns the HTTP 204 (No Content) status code if delete is successful.
HTTP 204 - NO CONTENT
List Conversion Types
Returns the list of available upload conversion types for a particular account.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/{accountRef}/conversionTypes/available
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
- accountRef (string) - Identifies the account within the network.
GET Params
- authSessionKey (string) OPTIONAL - Unique identifier for the auth session.
- authUsername (string) OPTIONAL - Login for the paid search network that has access to the required account.
- authPassword (string) OPTIONAL - The password that relates to username.
Response:
Returns the conversion types.
- ref (string) - The ID of the conversion tracker.
- name (int) - The name of the conversion tracker.
Response example:
HTTP 200 - OK
{"ref":14962301,"name":"Infinity Call Pass"}
Schedule account tagging job
Schedules an account tagging job. The account tagging job will analyse your account and send the results of that analysis in a file to the named recipient. The results file will contain suggested changes to ensure that your account is tagged correctly for Infinity. It should be loaded into AdWords Editor or Bing Ads Editor for review before posting.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/ppc/networks/{networkCode}/accounts/{accountRef}/checkTagging
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- networkCode (string) - Network Code, e.g. “gaw” or “mac”.
- accountRef (string) - Identifies the account within the network.
POST Params
- recipient (email) - The email address that will receive the results file with suggested changes.
Response:
HTTP 202 - ACCEPTED