Calling data via API - novice

I would like to access the Arduino Nano IoT data that is on a Arduino IoT Cloud Dashboard through a call from Hubitat (i assuming an app - but not even sure of that). I have never programmed across system communication and honestly don't even know what my first problem is.
I have created the Arduino Client and Secret IDs.
How do I send that information to Arduino IoT Cloud?

Arduino States:

curl --request POST \
  --url '' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'grant_type=client_credentials' \
  --data 'client_id=YOUR_CLIENT_ID' \
  --data 'client_secret=YOUR_SECRET_ID' \
  --data 'audience='

looking to learn -- how to make this call and see that it returns something to indicate approved access and how (if i needed) to close the connection?
Will someone help me through this and/or point me to an example?


here's a code snippet:

    def params = [
        uri: "https://${tccSite()}/portal/${settings.thisdevice}",
        headers: [
            'Accept': '*/*', // */ comment
            'DNT': '1',
            'Cache': 'false',
            'dataType': 'json',
            'Accept-Encoding': 'plain',
            'Cache-Control': 'max-age=0',
            'Accept-Language': 'en-US,en,q=0.8',
            'Connection': 'keep-alive',
            'X-Requested-With': 'XMLHttpRequest',
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36',
	  timeout: 10

    if (debugOutput) log.debug "sending getStatus request"
    asynchttpGet("getStatusHandler", params)

def getStatusHandler(resp, data) {
	if(resp.getStatus() == 200 || resp.getStatus() == 207) {
		def setStatusResult = parseJson(
      	if (debugOutput) { 
      	    log.debug "Request was successful, $resp.status"
      	    log.debug "data = $setStatusResult"

Your --data will go either in "header" or in "body" (not shown) depending on the API.

There are a lot of examples on github if you search this Community for "weather" packages. They all do something similar. I picked my example because it shows cookies and jams a bunch of stuff into Header, not because you need to copy/paste it.

Thanks for that: I've been looking at a lot of examples. I've gotten to the point that I have received the information on my access_key. I'm having two more issues now.

  1. I'm not getting information out of the function call - tried many different things TempTxt = and def of TempTxt outside the function, passed as ...Login(TempTxt) and even return TempTxt. How do I get it out of the function.
  2. is it because this return information is 'x-www-form-urlencoded' vs 'json' which Arduino doesn't reply to.

I'm struggling but having fun trying...

responded with:

which goes on with ...mndjsk..","expires_in:300,"Token_type":"Bearer"}

Download the Hubitat app