Connection to the rest of the world

The API of MoneyBird enables you to access the information inside a MoneyBird account. The API is RESTfull and uses XML for the data representation. On this page you can find all information about the API. Don't hesitate to contact us with your questions on info@moneybird.nl.

For Ruby-on-Rails programmers: don't forget to use ActiveResource! If you want to use the MoneyBird API with PHP, please take a look at the PHP library on GitHub.

Example Invoice update

← Back to API documentation
 1 require 'rubygems'
 2 require 'curb'
 3 
 4 # Create a new Curl instance with the correct accept and content-type headers
 5 c = Curl::Easy.new do |curl|
 6   curl.headers["Accept"] = "application/xml"
 7   curl.headers["Content-Type"] = "application/xml"
 8   curl.http_auth_types = Curl::CURLAUTH_BASIC
 9   curl.userpwd = "admin:testtest"
10 end
11 
12 # Specify the invoice you want to update
13 c.url = "http://bluetools.moneybird.local/invoices/1054583401.xml"
14 
15 # Specify the fields to be updated (the other fields are untouched)
16 # Details with an id are updated, new details can be added by leaving the id field out.
17 update_invoice_xml = '<invoice>
18   <name>Slagerij Jansen</name>
19   <description>U wordt vriendelijk verzocht het bedrag te betalen</description>
20   <details_attributes type="array">
21     <detail>
22       <id>889828995</id>
23       <description>Description updated</description>
24       <tax>0.06</tax>
25     </detail>
26     <detail>
27       <description>Some new description</description>
28       <amount>2</amount>
29       <price>10.50</price>
30     </detail>
31   </details_attributes>
32 </invoice>'
33 
34 # Create a post request
35 c.http_put(update_invoice_xml)
36 
37 # Check if the request is successfull
38 if c.response_code == 200
39   puts "Updated invoice successfully"
40 else
41   puts "Error updating invoice:"
42   puts c.body_str
43 end