Consume API from within Sugar

Hi, I would like to add a custom button to the opportunities module that makes a call to a custom endpoint that I created inside Sugar

The endpoint requires authentication, so I was wondering what would be the best way to call this endpoint from within the record.js file?

Thanks in advance