Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Campaign Error:4101 #37

Open
ArifurKhan opened this issue Feb 25, 2016 · 4 comments
Open

Create Campaign Error:4101 #37

ArifurKhan opened this issue Feb 25, 2016 · 4 comments

Comments

@ArifurKhan
Copy link

Hi,

I integrated the campaign monitor api in our project. In our local server, everything is fine and campaign is created successfully. But when it is in production, then it behaves abnormally. sometimes it is giving 4101 code ( singleline tag missing, but in the html, singleline tag exists ), but in the next try, it is created campaign with the same html.

Can anyone suggest, what can be the reason?

@mjwills
Copy link

mjwills commented Feb 25, 2016

Sorry to hear you are having issues.

Can you show an example of the code you are using (with API keys and other IDs removed)?

@ArifurKhan
Copy link
Author

here is the main function. Please note that I am sending an html template which contains some image links, and so I am sending emplty singlelines and multilines.

my html link is : https://agent.condonow.com/emailtemplates/buyline%20for%20Agents/buyline-email-template.html

private string CreateFromTemplate(AuthenticationDetails auth, string TemplateURL, string cid, string listid, string subject, string campaignname, string fromName, string fromEmail, string replyTo)
{
try
{
List listIDs = new List();
listIDs.Add(listid);

            Subscriber scr = new Subscriber(auth, listid);

            List<string> segmentIDs = new List<string>();
            //string segmentid = Segment.Create(auth, listid, campaignname, null);
            //segmentIDs.Add(segmentid);

            TemplateContent templateContent = new TemplateContent();

            List<EditableField> singlelines = new List<EditableField>();
            EditableField singleline = new EditableField();
            singleline.Content = "";

            singlelines.Add(singleline);
            templateContent.Singlelines = singlelines;

            List<EditableField> multilines = new List<EditableField>();
            EditableField multiline = new EditableField();
            multiline.Content = "";
            multilines.Add(multiline);
            templateContent.Multilines = multilines;

            string NewTemplateID = Template.Create(auth, cid, campaignname, TemplateURL, null);

            HttpContext.Current.Session["NewTemplateID"] = NewTemplateID; 

            string campaignID = Campaign.CreateFromTemplate(
                auth,
               cid,
                subject,
                campaignname,
                fromName,
                fromEmail,
                replyTo,
                listIDs,
                segmentIDs,
                NewTemplateID,
                templateContent);

            return campaignID;

        }
        catch (CreatesendException ex)
        {
            ElmahErrorFacade.Add(ex, "CampainMonitor.CreateFromTemplate");
            return ex.Message.ToString();
        }

    }

@mjwills
Copy link

mjwills commented Feb 25, 2016

OK, so that error is likely originating from the Template.Create call rather than the Campaign.CreateFromTemplate call.

One possible explanation of what you are seeing is that for some invocations of Template.Create the campaign monitor API is having issues accessing TemplateURL . Is it possible that the web server serving up TemplateURL perhaps had some issues / downtime when the call to Template.Create failed?

@ArifurKhan
Copy link
Author

Thanks for your reply Mr. Wills.

But I am afraid there is no possibility of error about the template url or template content. Do you have any other idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants