How to access inventory API from javascript?

How to access inventory API from javascript?

I'm trying to create a button on a page in creator which when pressed does an API call to packages in Zoho inventory. Here's my code in deluge. 

  1. print = invokeurl
  2. [
  3. url :"https://inventory.zoho.com/api/v1/packages/print?organization_id=849303927"
  4. type :GET
  5. parameters:parameterMap
  6. connection:"packages_oauth"
  7. ];
The problem is that I don't know how to trigger this code by the user pressing a button on a page. I saw that there was a way to embed a widget onto a page which would use HTML and Javascript. I was wondering if it's possible to call this API using HTMl and if it is then how would I authorize the call?