"Update an email campaign" in the ruby SDK

Participant

"Update an email campaign" in the ruby SDK

I'm developing API interface for constant contact, but I faced a problem, I cannot update an email campaign using the API method described.

 

# File 'lib/constantcontact/api.rb', line 222

def update_email_campaign(access_token, campaign)
  Services::EmailMarketingService.update_campaign(access_token, campaign)
end

 

 what I try to do is get 

old_campaign = @cc.get_email_campaign(@token,params[:id])
old_campaign.name = "change name"
old_campagin.subject = "change subject"

@cc.update_email_campaign(@token,old_campaign)

 I've no idea how to perform this function. 

Thanks!

1 REPLY 1
Member

Hello,

 

Based on the information that you have provided, it appears that the code you have will work properly as long as you have a campaign ID that you can use. If you need to get a list of campaigns in your account through the API, you can use this code:

@cc.get_email_campaigns(@token)

 That will give you a ResultSet object containing all (or the first page - if the set is large enough to be paginated) of your campaigns.

 

If you have any further questions, please let me know!

 

Best Regards,

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page