Created
February 16, 2022 16:56
-
-
Save billinkc/a18ce7071a8c53dc03080409d039599b to your computer and use it in GitHub Desktop.
Replaced the console/debug calls with FireInformation events as I never had the former show anywhere in the logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void CreateNewOutputRows() | |
{ | |
// added | |
bool fireAgain = false; | |
System.Net.ServicePointManager.SecurityProtocol = | |
SecurityProtocolType.Tls12 | | |
SecurityProtocolType.Tls11 | | |
SecurityProtocolType.Tls; | |
HttpClient client = new HttpClient(); | |
client.BaseAddress = new Uri("https://mycompany.jotform.com/API/form/222222222222222222/submissions&apiKey=25555555xxxxxxxxxxx5555555"); | |
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); | |
string APIUrl = string.Format("https://mycompany.jotform.com/API/form/222222222222222222/submissions&apiKey=25555555xxxxxxxxxxx5555555"); | |
var response = client.GetAsync(APIUrl).Result; | |
if (response.IsSuccessStatusCode) | |
{ | |
ComponentMetaData.FireInformation(0, "Debug Source", "Status true from web call", "", 0, ref fireAgain); | |
var result = response.Content.ReadAsStringAsync().Result; | |
var serializer = new JavaScriptSerializer(); | |
var data = serializer.Deserialize<ResultAPI>(result); | |
ComponentMetaData.FireInformation(0, "Debug Source", "Deserialized just fine", "", 0, ref fireAgain); | |
Output0Buffer.AddRow(); | |
Output0Buffer.FirstName = data.givenName; | |
Output0Buffer.Surname = data.familyName; | |
ComponentMetaData.FireInformation(0, "Debug Source", result, "", 0, ref fireAgain); | |
//Console.WriteLine(result); | |
//System.Diagnostics.Debug.WriteLine(result); | |
var json = JsonSerializer.Serialize(response); | |
ComponentMetaData.FireInformation(0, "Debug Source", json, "", 0, ref fireAgain); | |
//Console.WriteLine(json); | |
//System.Diagnostics.Debug.WriteLine(json); | |
} | |
else | |
{ | |
Output0Buffer.AddRow(); | |
Output0Buffer.FirstName = "Status"; | |
Output0Buffer.Surname = "Code false"; | |
ComponentMetaData.FireInformation(0, "Debug Source", "Status false from web call", "", 0, ref fireAgain); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment