Skip to content

Conversation

@brycejech
Copy link
Contributor

Added support for POST, PUT, DELETE, etc as well as body content and HTTP headers. Changes make no assumptions about the type of headers and body content passed in, up to the user to send correct headers and format body appropriately.

Example:

// Body sample from API explorer examples
const body = {
  TrackQtyOnHand: true,
  Name: "Garden Supplies",
  QtyOnHand: 10,
  InvStartDate: "2015-01-01",
  Type: "Inventory",
  IncomeAccountRef: {
    name: "Sales of Product Income",
    value: "79"
  },
  AssetAccountRef: {
    name: "Inventory Asset",
    value: "81"
  },
  ExpenseAccountRef: {
    name: "Cost of Goods Sold",
    value: "80"
  }
};

const res = await client.makeApiCall({
  url: 'https://sandbox-quickbooks.api.intuit.com/v3/company/1234/item',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(body)
});

@abisalehalliprasan
Copy link
Collaborator

abisalehalliprasan commented Oct 16, 2019

Awesome @brycejech 👍 . I liked the way you've handled passing explicit headers to the client object.

Ref : #40

@brycejech
Copy link
Contributor Author

Thanks @abisalehalliprasan, I didn't want to make any assumptions about content types that the API may accept in the future.

@abisalehalliprasan
Copy link
Collaborator

🚀 PR was released in v2.0.0 hacktoberfest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants