Okay here is the example, but I don’t think you’ll need it.
The scheduled functions I submitted ran under my user Account, so depending on use case,
you may not need this.
//Calling A Function From A Function Using Rest With Different Credentials
string user = "Big Joe";
string pass = "Password1";
byte[] encoded_userPassBytes = System.Text.Encoding.UTF8.GetBytes($"{user}:{pass}");
string encoded_userPass = System.Convert.ToBase64String(encoded_userPassBytes);
string API_Key_Label = "x-api-key";
string API_Key = "iLiKeBiGbUtTsAnDiCaNnOtLiE";
string thisLibraryName = ThisLib.ToString().Split(".")[1];
string functionToCall = "function-5";
string serverUrl = $"{Session.AppServerURL}/api/v2/efx/{Session.CompanyID}/{thisLibraryName}/{functionToCall}";
var client = new RestClient(serverUrl);
string content = String.Empty;
var request = new RestRequest();
request.AddHeader("Accept", "*/*");
request.AddHeader(API_Key_Label, API_Key);
request.AddHeader("Authorization", $"Basic {encoded_userPass}");
request.Method = Method.POST;
request.AddParameter("application/json", content, ParameterType.RequestBody);
var response = client.Execute(request);