Codementor Events

How I learned MYOB API Integration

Published May 04, 2018Last updated Oct 31, 2018
How I learned MYOB API Integration

About me

I am a CS graduate and PHP developer, interested in newer concepts, technologies, and experiments. I have been freelancing for the last eight years and have worked for lots of clients and companies worldwide.

I started off with WordPress customization, then moved to custom theme development, and finally jumped to plug-in development. I have also helped a lot of clients optimize WordPress and make load times faster.

Why I wanted to learn MYOB API Integration

I got a project from someone where they wanted to link their eCommerce website with their accounting system so all transations could sync without them updating each of them.

The accounting system they used was MYOB and the API which I had to use for interacting with the accounting system was Accountright API.

They wanted to create every order from their website to the accounting system, send emails to their users from the website if their membership was expiring in the accounting system, and many more things.

How I approached learning MYOB API Integration

I had no clue about MYOB accounting software then, but had extensive knowledge of WordPress plugins and its core, so I was confident about one side of project at least 😃 I started reading API docs and looking at PHP code samples for integrating with the API.

Challenges I faced

I found a MYOB oauth authentication library in PHP. The library was very basic. It only had code for authentication, getting access tokens for API, and listing data from APIs.

There were no calls for create/update or delete, which meant I had to write code by myself and make sure all of the required parameters were sent.

This was not easy. The API gave very vague errors, which made it even more difficult. MYOB support was useless — if you asked them something, they would give you canned replies or very vague answers, which were pretty useless.

Key takeaways

I worked hard on this project but enjoyed it at the same time. I learned how to send API calls with all required parameters, check response headers sent by API, make efficient API calls, and get specific results from API using filters that made data retrieval quick.

The filters were difficult to write because the API was sensitive about quotes, double quotes, and escaping characters. I also learned how to deal with special characters.

Tips and advice

I would advise you to start with basic PHP wrappers, which are built for oauth, and then start adding your functions to it.

Final thoughts and next steps

I was able to complete it and after this one, I did a few other projects dealing with the same API. Now I feel I am pretty good at it 😃

Discover and read more posts from Yumna
get started