API connections for dummies

API connections for dummies

I feel really stupid asking this, but my brain doesn't seem to work properly when thinking about API connections.

I have a third party app that I'm trying to connect to.  I have to send credentials (API key in header, username/password in parameters) to the login URL get a token that is valid for an hour.  I then send another request (API key and token in header, record information I want to get data from in parameters) to different URLs (depending on the data I want). 

Inside a function, I can do this without issue.  I don't like the API key, username and password being visible so assumed that a Connection was the right thing to do.... but can I work out how to do it?!  Absolutely not.  

My issue is mainly the username and password - I've got the API key in the header in the connection, which seems to work.  I've setup the username and password as dynamic parameters.... but how do I add these to a map in order to pass them?! At the moment I've got the actual username and password in my code, getting added into a map.

Please can someone give me a really basic guide as to how I can do this?  I've read lots and still can't work it out.  I don't have a secret key or anything.  I just have an API key, username and password.  It's OAS3 - not sure if that's relevant.  

Much appreciated!!