Search

Has anyone integrated fresh books with symphony before? I'm looking into to using it and wanted to know if its more trouble then its worth.

I've never heard of freshbooks before, but (briefly) looking at their api, it seems that you can pull data in via a XML feed. Though, i just tried hitting this url:

https://sample.freshbooks.com/api/2.1/xml-in

and it seems that there is still some sort of authentication required, so that may be a stumbling block there. but if you can get past that, i don't see why you can't use their xml feed to pull in data.

I think my problem is not knowing how to send an xml file from symphony to that url,

I have the information I need in symphony Im just not sure how to build an xml file to send it...

And Im not sure how to get the responses back in to symphony.

I'm more of a front end person, having never built an extension of my own. I could build a small invoicing system im sure on my own but freshbooks has so many features that would take forever for me to recreate.

Ill spend some more time looking at their docs and see if i can figure something out.

You would need a page to display the datasource on and then just use xslt to transform your data into the correct schema for freshbooks.

As long as you can get examples of what is expected at their end, you're laughing really...

So I know i need to send things like this

    <?xml version="1.0" encoding="utf-8"?>  
<request method="invoice.update">  
  <invoice>  
    <invoice_id>344</invoice_id>            <!-- Invoice to update -->  
    <!-- Remaining arguments same as invoice.create -->  
  </invoice>  
</request>  

to the https://sample.freshbooks.com/api/2.1/xml-in URL with an author token

Im just not sure how to do it. The docs and forum dont seem to have anything that suits me. Do I use a form = post ? if so how do i post an xml request like shown.

Perhaps this is much easier then I think, hopefully.

Any help would be appreciated.

Ah, you're going to need to use some custom events to POST to freshbooks (I thought GET for some reason), but it all depends on what sort of thing you're building. It may need to go as far as a custom extension...

Hmm that's what I thought. I'll look into again next week If i figure it out i will post the solution

Ok so Ive found this curl example on how to send info to create a client I tried putting it in a custom event in the trigger area, I then built a form to send all the post fields, even though an email was given I get an error here is the code first

$xml = "
        <?xml version="1.0" encoding="utf-8"?>
        <request method="client.create">
          <client>
            <first_name>$_POST[first_name]</first_name>
            <last_name>$_POST[last_name]</last_name>
            <organization>$_POST[organization]</organization>
            <email>$_POST[email]</email>
            <username>$_POST[email]</username>
            <work_phone>$_POST[work_phone]</work_phone>
            <home_phone>$_POST[home_phone]</home_phone>
            <mobile>$_POST[cell]</mobile>
            <fax>$_POST[fax]</fax>
            <notes>$_POST[notes]</notes>
            <p_street1>$_POST[street_1]</p_street1>
            <p_street2>$_POST[street_2]</p_street2>
            <p_city>$_POST[city]</p_city>
            <p_state>$_POST[state]</p_state>
            <p_country>USA</p_country>
            <p_code>$_POST[zip]</p_code>
          </client>
        </request>
        ";
            $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, ##EDITED OUT##);
        curl_setopt($curl, CURLOPT_USERPWD, ##EDITED OUT##);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
        $curl_result = curl_exec ($curl);
        curl_close ($curl);
        if (strlen($curl_result) < 2) { return "Could not connect to FreshBooks server."; }
            $returnXML = simplexml_load_string($curl_result);
            if($returnXML[status] == "fail")
        {
        print "The XML request to FreshBooks failed, the returned error was:<BR>";
        print $curl_result;
        } else {
        // show the ID
        $echo=$returnXML->client_id;
        }

The error is The XML request to FreshBooks failed, the returned error was: 'Email' is a required field.

That is posted above a symphony error page that says Cannot modify header information - headers already sent by (output started at /ssd/home/chee1376/publichtml/lifecover.ca/workspace/events/event.fbaddbroker.php:153) /ssd/home/chee1376/publichtml/lifecover.ca/symphony/lib/toolkit/class.page.php line 30

25      protected function __renderHeaders(){
26
27          if(!is_array($this->_headers) || empty($this->_headers)) return;
28
29          foreach($this->_headers as $value){
30              header($value);
31          }
32
33      }       
34  }

So I guess Im curious if anyone can spot the problem or point me in the right direction sorry I'm a front end guy so creating a custom event isnt a piece of cake for me.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details