Skip to content

Allow to send an empty object as a json parameter in Freshbooks#call #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow to send an empty object as a json parameter in Freshbooks#call #2

wants to merge 1 commit into from

Conversation

roperzh
Copy link

@roperzh roperzh commented Sep 16, 2014

Hello,

First of all thanks for this awesome & super-simple library.

Actually, some of the endpoints in the freshbooks API doesn't require any parameters, for example staff.current.

Currently the xml request for this:

freshbooks.call("staff.current", {}, function(err, response) {
  console.log(response);
});

Is formatted like this:

<?xml version='1.0' encoding='utf-8'?>
<request />

And the API returns:

{ response: { error: 'Your XML is not formatted correctly.', code: '40010' } }

With this simple change you can pass empty objects or even null as a second argument to Freshbooks#call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant