Using API to create GKE cluster

Hi all, I am new to Rancher as well as to this forum so please bear with me. I have been searching for instruction on how to use the Rancher API (v3) to manage clusters on GKE, specifically creating clusters, and came up with very little from the internet. The quick start guide only showed examples with Digital Ocean and AWS. I am writing a custom NodeJS app to auto provision our Kubernetes apps (wrapped in Helm charts), a one click so to speak, to create clusters, and to deploy the selected apps, not unlike how a human uses the Rancher UI to do this in multiple steps. I got to the point where I was able to query all of the Rancher resources (schemas), via the API, I am now stuck at the cluster creation step, where I sent the cluster spec (with the embedded GKE config structure) along with the POST clusters command to Rancher, and got back some authorisation/authentication problem. In the Rancher UI, this is the point where you basically upload the GKE service account key (in JSON format) to proceed with the cluster creation process, I don’t know how to achieve this effect using the API. I tried pasting stuff into the googleKubernetesEngineConfig.credential which resulted in " Google: error getting credentials using GOOGLE_APPLICATION_CREDENTIALS environment variable: invalid character…"

If any one can point me to some documentation, instruction, or other thread(s) that might touch on this it would be greatly appreciated.

Oh, hey I figured out this part, the googleKubernetesEngineConfig.credential parameter should be set to the content of the aforementioned GKE service account key JSON file, as a string, not as a JSON object. So you would send a body of the clusters POST request something like so:
{
name = “your cluster name goes here”,
googleKubernetesEngineConfig = {
credential = “content of service account key file goes here”,
diskSizeGb = 100, // Example
machineType = “n1-highmem-2”, // Example
projectId = “project ID extracted from service account key file”,
zone = “northamerica-northeast1-a”, // Example
}
}

It took almost a day to figure out the correct json format to credential request.