Added API error check with option callback function
Merge pull request #2 from yvesvanbroekhoven/master

Added API response code check