How to call external API with Basic Auth?

I want to call an external API with basic auth on build.

In the documentation it says: “Currently, you can only use those authentication methods that can be put into an URL”.

In my case the authentication is provided by a header. I already know, that the getJSON function can’t handle this case (see: Allow user-defined HTTP headers with getJSON and getCSV). But what is the solution to this problem? How do you handle API calls with Basic Auth?