TypeScript typings for Search Ads 360 API v2
The Search Ads 360 API allows developers to automate uploading conversions and downloading reports from Search Ads 360.
For detailed description please check documentation.
Installing
Install typings for Search Ads 360 API:
npm install @types/gapi.client.doubleclicksearch-v2 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load(
'https://doubleclicksearch.googleapis.com/$discovery/rest?version=v2',
() => {
}
);
gapi.client.load('doubleclicksearch', 'v2', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/doubleclicksearch',
],
immediate = true;
gapi.auth.authorize(
{client_id: client_id, scope: scope, immediate: immediate},
authResult => {
if (authResult && !authResult.error) {
} else {
}
}
);
After that you can use Search Ads 360 API resources:
await gapi.client.doubleclicksearch.conversion.get({
advertiserId: 'advertiserId',
agencyId: 'agencyId',
endDate: 1,
engineAccountId: 'engineAccountId',
rowCount: 1,
startDate: 1,
startRow: 1,
});
await gapi.client.doubleclicksearch.conversion.getByCustomerId({
customerId: 'customerId',
endDate: 1,
rowCount: 1,
startDate: 1,
startRow: 1,
});
await gapi.client.doubleclicksearch.conversion.insert({});
await gapi.client.doubleclicksearch.conversion.update({});
await gapi.client.doubleclicksearch.conversion.updateAvailability({});
await gapi.client.doubleclicksearch.reports.generate({});
await gapi.client.doubleclicksearch.reports.get({reportId: 'reportId'});
await gapi.client.doubleclicksearch.reports.getFile({
reportFragment: 1,
reportId: 'reportId',
});
await gapi.client.doubleclicksearch.reports.getIdMappingFile({
advertiserId: 'advertiserId',
agencyId: 'agencyId',
});
await gapi.client.doubleclicksearch.reports.request({});
await gapi.client.doubleclicksearch.savedColumns.list({
advertiserId: 'advertiserId',
agencyId: 'agencyId',
});