Using API without client library

I’m using Go to attempt to use the REST API. I can do the call successfully with curl, but when I try it with Go, I get an error because the header “Authorization:Bearer” is illegal.

So, I checked the client library on Github, and I see it’s not using any such header; only HTTP basic auth. So, I try that and I get the error token_not_found.

I’m setting the Content-Type, Accept, and User-Agent headers just as the client library does.

Does anyone know what it takes to consume the API from Go without adding thousands of lines of unnecessary code to my application?

Thanks!

Finally figured it out.

In short, the API key (the base64-encoded key) needs to be base64 encoded a second time, then the string 'Basic ’ needs to be prepended. This is the value for the “Authorization” header.

For example, if the base64 password is: MWRQcFVMS0dEU29mNFlySkJNOHNaSDh6eW5QCg==

A base64 encoding of that would be:
TVdSUWNGVk1TMGRFVTI5bU5GbHlTa0pOT0hOYVNEaDZlVzVRQ2c9PQo=

So the value for the “Authorization” header would be:

“Basic TVdSUWNGVk1TMGRFVTI5bU5GbHlTa0pOT0hOYVNEaDZlVzVRQ2c9PQo=”