9 Replies Latest reply on Apr 5, 2018 1:08 PM by Sanford Whiteman

    Get email data of an email inside a program via API

    API Dev

      Hi All,

       

      So I'm looking at this API endpoint reference:http://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Emails/getEmailByNameUsingGET and there's an option to pass folder related data as JSON representation as mentioned here: http://developers.marketo.com/rest-api/assets/emails/#by_name but when I'm trying to test it on Postman I get the message that the "Folder id is not valid". I'm just trying to figure out what is the correct method to pass that json representation besides the email name to the GET request endpoint url. Surely I don't want to treat mkto nation as stackoverflow, though it would be great help in my code with your suggestions/recommendations.

       

      Thanks

        • Re: Get email data of an email inside a program via API
          Jim Thao

          Declare a Folder ID and pass it in a param.  If your folder ID is "97" then your url should look like this:  /rest/asset/v1/email/byName.json?folder=97

           

          Note there is a difference between folders and programs.

           

          Here's a full endpoint for reference: /rest/asset/v1/email/byName.json?accesstoken=something&name=something&folder=97

            • Re: Get email data of an email inside a program via API
              API Dev

              Hi Jim,

              Thank you for your response. Appreciate it, although I want to know if I want to pass the Id of the program and not the folder, would I be defining the program Id in the same manner or follow some other syntax? The email whose data I want to read resides in an email blast program.

               

              Thanks.

                • Re: Get email data of an email inside a program via API
                  Sanford Whiteman

                  Well, the example in the docs is wrong (this happens) as the JSON is broken (using = after the property name instead of :, and it also uses curly quotes!).

                   

                  If you pass well-formed JSON you'll be fine:

                   

                  folder={"id":3789,"type"="Program"}
                  

                   

                  which of course goes on the wire as

                   

                  folder%3D%7B%22id%22%3A3789%2C%22type%22%3D%22Program%22%7D
                  

                   

                  or you can (I don't know if this is documented) use the shorthand

                   

                  program=3789
                  

                   

                  You can't do exactly what Jim said for emails as they only support Programs (folder type=Program) as parents.