Mailchimp API 3.0. Need to retrieve a specific template HTML - mailchimp-api-v3.0

Am updating an the mailchimp API version form 1.2 -> 3.0
I am trying to retrieve a template HTML file.
But there are no methods to do this.
I could do this in ver 1.3 and 2.0
https://us1.api.mailchimp.com/1.3/?output=json&method=templateInfo&apikey=XXX
returned the full html of the template.
Is there a way to do this?
Can connect to the API with no errors, just cannot get the full html for a template. I have noticed there are some other old answers here (few years ago), but does anyone have any new info.
I could do this in ver 1.3 and 2.0
https://us1.api.mailchimp.com/1.3/?output=json&method=templateInfo&apikey=XXX&tid=280089
returned the full html of the template.
In ver 3.0 there is
https://us1.api.mailchimp.com/3.0/templates/280089/default-content
does not return full html

As far as I know you can retrieve the HTML content from the Campaign that is using the template but not template itself.
Not sure why. This would only work once a campaign is created but not on templates not used yet. Strange behavior.
https://mailchimp.com/developer/api/marketing/campaign-content/get-campaign-content/

Related

Xrm object undefined on SiteMap Html web resource in D365 Online

I have an Angular html page that has script reference to the javascript. In the Javascript I am using Xrm object to make certain actions like Xrm.webApi.retrieveMultipleRecords etc..
This Angular Html Web resource is loaded as part of SiteMap. The Angular Html web resource also have script reference to "ClientGlobalContext.js.aspx" and able to access Xrm object.
If I remove the aspx script reference the Xrm object is undefined. Microsoft docs mention that this script reference doesn't make the Xrm object available but in my case it's exactly what it is doing.
Then I tried removing the "ClientGlobalContext.js.aspx" reference and started using parent.Xrm object and everything seems to be working fine again. But the Microsoft docs again said that parent.Xrm will not work if loading an HTML web resource as part of SiteMap which exactly is my scenario and seems to be working.
So need to know what I should do as I don't want to use any methods that's going to be deprecated.
Here is the link to the Microsoft docs: Screenshot of the issue
https://learn.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/getglobalcontext-clientglobalcontext.js.aspx
I had a similar problem using Xrm.WebApi object in a Web Resource as well.
See here: Using Xrm.WebApi method in Web Resource opened in a new window
The short answer is, is that the methods rely on JavaScript constants that are only loaded on the CRM pages. You can work-around the issue by providing your own constants, and copy the values from window.opener.top.

Share templates between Laravel and JavaScript

How do I share template information between my PHP backend and JavaScript / AJAX requests?
Times ago I just sent my AJAX requests and had the HTML generated by the server and sent as such. Today I have my AJAX data as JSON but I have no idea how to use the same template (e.g. a users list) at the server side and (for refreshing, filtering etc.) at client side without creating redundant layout code.
Is there a template language with parsers as well for PHP/Laravel and JavaScript?
The Laravel template engine Blade is obviously not usable in JavaScript.
The only sharing template language I found via Google was Mustache, but the parser for Laravel was outdated.
Is there anything else out there and which approach do you use for that?
Your boiled down question:
Is there a template language with parsers as well for PHP/Laravel and
JavaScript?
Laravel and Mustache | server side:
conarwelsh/mustache-l4 is a Mustache.php wrapper for Laravel 4. They seems to keep up very well as opposed to what you tell (I presume you mean michaelenger/mustacheview which is actually a Laravel 3 bundle). I stand corrected if am wrong.
Laravel's Blade doesn't rule out Mustache at all. You just have to create a Mustache partial without using blade.php extension and include it within a regular Blade template using #include (More details here)
Serving Mustache template:
You can even coin any custom Response you need using Response Macros such Response::mustache(...) leveraging Response::make(...) (see here for more details).
Some samples of interest:
Combining Laravel 4 and Backbone.
Sharing Templates Between PHP and JavaScript | PHP but still relevant!
My short answer (Updated):
Don't look elsewhere: Laravel + Mustache + Javascript if a mix of server|client side rendering is part of your requirements.
Get your hands dirty! :)
I had the same issue with Laravel and Angularjs, what I did is that I created a route to return templates http://domain.com/templates/name
This route will View::make('templates'.$name);, this is an AngularJs template that will be filled with data returned by JSON API. Remember to use non conflicting tags I used {{ for Laravel and <% for Angular.
RENDER YOUR TEMPLATE SERVER SIDE! I'm not sure at what point someone decided you needed to send JSON to the front end, but that's not how they do it in Rails. In Rails, they actually render the template server side, then send it back to the front end and your JS appends it to the page (or, actually sends back the JS + the markup to attach). This saves a ton of time and headache, trust me.

MailChimp API createCampaign

I have the template i want on a server somewhere, with images and all. How do I just use that as a template? or cant you use a zipped version with all the media like you would when manually setting up a campaign ?
using mailchimp. you will be asked to upload an HTMl or create your own template. if you want you can create your own newsletter in HTML then upload the HTML in your mailchimp.
Minimize your HTML code due to compatibility and use the images that is uploaded in your server by specifying thier location like src="www.domainname.com/location/image.jpg"

MVC sitemap provider & css styling

Does anyone know how to customise the rendering of the MVC sitemap provider so my ul element has a specific css class?
Try MvcSiteMapProvider hosted on CodePlex. You should be able to fairly easily migrate your existing Sitemap file to the slightly different but essentially compatible format. This will give you the ability to output your sitemap using the simple Html.MvcSiteMap().SiteMap() helper method.
The source of the project includes the default templates which you can edit to produce any rendering you like...or just pass in the name of a template in accordance with MVC convention. The model types you'll be rendering are SiteMapHelperModel, SiteMapNodeModel and SiteMapNodeModelList (namespaces removed for terseness).
I appreciate this may not be exactly what you're after as it relies on a 3rd party tool but its a useful project that supports much more than just rendering sitemaps. You'll want version 3.0.0 for MVC3.
Dan

Modify MailChimp CampaignTemplateContent

I have just started to use mailchimp as a solution with an asp.net mvc application I am writing.
I am trying to use the mcapinet.codeplex.com wrapper.
I have created a template based on one of the precreated templates so I have all of the areas available to insert.
How do I insert insert my desired html into the template without affecting anything else? I basically just want to have a placeholder where I can dump in my own html.
Has someone done this?
Any help would be great!
This has to be one of the most confusing things I've tried to learn about MailChimp's API. Forget everything you know about trying to use |MERGE_TAGS|. You'll end up editing your template and using MC encoded form tags.
Here is an example: Iterating over collection in mailchimp template via API

Resources