"Update an email campaign" in the ruby SDK

Highlighted
Member

"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
Highlighted
Honored Contributor

Re: "Update an email campaign" in the ruby SDK

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

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured