I'll show you all of the code.
'use strict';

const rp = require('request-promise-native');

const accessToken = '************'; // replace correctly
const customer_id = 1234567890; // replace correctly

const putCampaign = async () => {
 try {
 const url = 
`https://googleads.googleapis.com/v1/customers/${customer_id}/campaigns:mutate`
;

 const operations = {
 'operations': [
 {
 'create': {
 'name': 'new Campaign 1',
 'advertising_channel_type': 'SEARCH',
 'status': 'PAUSED',
 'campaign_budget': 100000,
 'start_date': '20190601',
 'end_date': '20190701',
 'network_settings': {
 'target_google_search': true,
 'target_search_network': false,
 'target_content_network': false,
 'target_partner_search_network': false
 },
 'dynamic_search_ads_setting': {
 'domain_name': 'fooooo.com',
 'language_code': 'jp',
 'use_supplied_urls_only': true,
 'labels': ['test']
 },
 'bidding_strategy_type': 'ENHANCED_CPC',
 'payment_mode': 'CLICKS'
 }
 }
 ]
 };

 const options = {
 method: 'POST',
 headers: {
 'Content-Type': 'application/json',
 'Authorization': 'Bearer ' + accessToken,
 'developer-token': '************', // replace correctly
 'login-customer-id': 6789012345, // replace correctly
 },
 data: operations,
 json: true,
 resolveWithFullResponse: true
 };

 const res = await rp(url, options);
 if (res.statusCode === 200) console.log(res.statusCode, res.statusMessage, 
res.body);
 } catch (err) { console.log(err.message); }
};

const main = async () => {
 try {
 await putCampaign();
 } catch (err) { console.log(err); }
}

main();

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/643cf21c-c506-4e07-9c48-78e8d2a38e74%40googlegroups.com.

Reply via email to