Thank you so much, Sai. I was able to create an empty campaign. I've put 
the successful code below.

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


const customer_id = 1234567890;
const developerToken = '*******************';
const loginCustomerId = 9876543210;
const accessToken = '*******************';


const headers = {
 'developer-token': developerToken,
 'login-customer-id': loginCustomerId,
 'Accept-Charset': 'utf-8',
 'Content-Type': 'application/json',
 'Authorization': 'Bearer ' + accessToken
};


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


 const operations = {
 'operations': [
 {
 'create': {
 'name': 'new budget test 1',
 'amount_micros': 100000000,
 'status': 'ENABLED',
 'delivery_method': 'STANDARD',
 'type': 'STANDARD'
 }
 }
 ]
 };


 const options = {
 method: 'POST',
 headers: headers,
 body: operations, // not data:
 json: true,
 resolveWithFullResponse: true
 };


 const res = await rp(url, options);
 return res.body.results[0].resourceName;
 } catch (err) { console.log(err.message); }
};


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


 const operations = {
 'operations': [
 {
 'create': {
 'name': 'new campaign test 1',
 'advertising_channel_type': 'SEARCH',
 'status': 'PAUSED',
 'campaign_budget': budgetResource,
 'start_date': '20190701',
 'end_date': '20190801',
 'network_settings': {
 'target_google_search': true,
 'target_search_network': false,
 'target_content_network': false,
 'target_partner_search_network': false
 },
 'manual_cpc': {
 'enhanced_cpc_enabled': false
 }
 }
 }
 ]
 };


 const options = {
 method: 'POST',
 headers: headers,
 body: operations,
 json: true,
 resolveWithFullResponse: true
 };


 const res = await rp(url, options);
 return res.body.results[0].resourceName;
 } catch (err) { console.log(err.message); }
};


const main = async () => {
 try {
 const budgetResource = await createBudget();
 const campaignResource = await createCampaign(budgetResource);
 console.log(campaignResource);
 } catch (err) { console.log(err); }
}


main();

We are still waiting for the endpoint and json sample code via curl.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/5f11915a-79fa-4fc4-b737-33cf9d4f3150%40googlegroups.com.

Reply via email to