11 Replies Latest reply on Oct 6, 2006 8:04 AM by jasals

    Integrating with offsite API

    cluksha
      Has anyone interfaced CF with Campaign Monitor's API ? http://www.campaignmonitor.com/api/ I am desiring to do so - but I am not even sure where to start looking for tutorials on interfacing with this type program. You can interface using Http-get, http-post and SOAP - and honestly I know very little about either of those options.

      Nay ideas on where to start or maybe an example if you have interfaced in the past?

      Thanks!
      Chris
        • 1. Re: Integrating with offsite API
          Level 7
          cluksha wrote:
          > Has anyone interfaced CF with Campaign Monitor's API ?
          > http://www.campaignmonitor.com/api/ I am desiring to do so - but I am not even
          > sure where to start looking for tutorials on interfacing with this type
          > program. You can interface using Http-get, http-post and SOAP - and honestly I
          > know very little about either of those options.

          the webservice (SOAP) would be ideal (ie won't have to parse any XML) but it
          seems to be throwing "Duplicate file name" errors when i tried to build
          webservice (ws) stubs for it. cf thinks there's ws programming errors but it
          might simply be the .NET nature of the ws (i'll leave that research to somebody
          else).

          http get might be easiest, here's a simple example to get the system datetime:

          <cfset apiKey="your API key goes here">
          <cfhttp
          url=" http://app.campaignmonitor.com/api/api.asmx/User.GetSystemDate?ApiKey=#apiKey#"
          method="GET" result="result" />
          <cfset sysTime=xmlParse(result.fileContent)>

          <cfdump var="#sysTime.anyType.xmlText#">

          it looks simple enough, the xml parsing will probably be the hardest part of this.
          • 2. Re: Integrating with offsite API
            jasals
            Has anyone actually tried this successfully? Can anyone post some sample code that I can get a jumpstart from?
            • 3. Re: Integrating with offsite API
              cluksha Level 1
              Hi Jonathan,

              I have seen nothing yet. I was going to try and develope something for them - but I got swamped myself and could not find the time to do it. Should you get something I would be grateful to see it too.

              Chris
              • 4. Re: Integrating with offsite API
                jasals Level 1
                Well, I am sort of in a spot wher I HAVE TO create a solution for this... so I will let you know what I end up doing...
                • 5. Re: Integrating with offsite API
                  jasals Level 1
                  OK, update.. after receiving little in the way of any good code samples or direction, I have tried the following.... and gotten errors. I am hoping beyond hope that somebody - maybe from the Adobe-Macromedia-ColdFusion team can look at this and give me some answers and direction.

                  I posted the code below and got:
                  Name: http://app.campaignmonitor.com/api/api.asmx?WSDL. WSDL: http://app.campaignmonitor.com/api/api.asmx?WSDL. org.apache.axis.wsdl.toJava.DuplicateFileException: Duplicate file name: C:\CFusionMX7\stubs\WS1938286156\com\campaignmonitor\app\api\SubscriberUnsubscribe.java. Hint: you may have mapped two namespaces with elements of the same name to the same package name. It is recommended that you use a web browser to retrieve and examine the requested WSDL document for correctness. If the requested WSDL document can't be retrieved or it is dynamically generated, it is likely that the target web service has programming errors.
                  • 6. Re: Integrating with offsite API
                    jasals Level 1
                    Well I ended up using an HTTP GET using CFHTTP as shown in the code below... but they have a custom fields option and their Get documentation doesn't seem to support this - so i will still need a SOAP solution eventaully to use their custom fields.... just thought I'd put this in to help anyone who may be trying to just put in a simple Subscriber.Add
                    • 7. Re: Integrating with offsite API
                      jasals Level 1
                      Chris,

                      I posted this reply on another topic, but wanted you to know where I ended up...

                      SADLY, there is little or no clear documentation on how to handle webservices that utilize overloading of methods. Equally missing is any input from the Macromedia/Adobe team in these forums on it. There are many webservices out there that use overloading of methods... this needs to be addressed!

                      Things used to be better in here... I miss the days of seeing many responses and Team Macromedia or Team Allaire getting involved in the difficult ones.

                      Anyway - in case you are trying to accomplish this or a similar task. Try PHP. It works beautifully, I never thought I'd be the guy saying that in here! After being a huge fan of CF for 10 years, I am touting PHP for this task... though I guess Ben Forta does encourage using the best tool in the shed for the task - just suprised that I would have to use another application language for this.

                      PHP, for this task, is very simple and straight forward, there is plenty of documentations and real world code examples to get you going via Google searches. Plus most shared servers running Cold Fusion also support PHP.

                      I don't like to mix technologies in a web site, but due to Cold Fusion's apparent inability to handle this, I have had to resort to doing this.

                      If you need specifics on how I did it, contact me and I will create a snippet that is sanitized for your use. Also you might want to look up other forum posts by me around Sept-Oct 2006 for other comments and code I tried in CF. Might save you a few failure steps with CF on your way to using the PHP route....


                      -Jon
                      • 8. Re: Integrating with offsite API
                        cluksha Level 1
                        Thanks Jon for hte update. I will keep it in mind when I do finally get around to working this through.

                        I won't start bashing the the company guys for the new found lack of forum support since Adobe took over. I can't believe they are at fault. But I'd bet that they aren't allowed to spend so much time with us these days :( Execs can never see the value in helping the customer for free.

                        At least there are many others out here who know what they are doing - and hopefully they will continue to give of their free time helping those of us that need it :)

                        -grumpy
                        • 9. Re: Integrating with offsite API
                          jasals Level 1
                          Oh, I don't want to bash the Team Adobe/Macromedia guys themselves... but this should be heard by the company leaders and responded to... if they aren't given the time to get in here as much or whatever, then Adobe is negatively impacting the user environment... Hopefully this could be ammo for the helpful people that do work there that don't have the time anymmore to pressure their leaders to allow them the time!
                          • 10. Re: Integrating with offsite API
                            gkraeger
                            Jonathan:

                            Are you locked into working with Campaign Monitor or are you feel to look at other solutions where an API is not neccesary and you can connect directly to your database. Our clients grew frustrated with working with our API so we ended up creating a solution they were more fimilar simple sql queries that they already know how to do.
                            • 11. Re: Integrating with offsite API
                              jasals Level 1
                              I will look at what you have. But in all honesty we have been using Campaign Monitor for some time now and migration would be a headache. Not that it is out of the question at some point. We will most likely outgrow this provider at some point and having other provider information will be good.

                              Thanks!
                              -Jon