06-03-2016, 08:38 PM
Hi there,
in order to automate my agile (in JIRA) test management, I'm trying to make use of REST APIs in a C# custom code.
To that end, I'm trying to send my request using HttpClient object in an Async function which can be seen at the end of the post.
The issue is that the execution of the code block throws out following runtime problem:
any help is appreciated in advance
HP.ST.Fwk.InternalExecuter.exe has stopped working
Details:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: HP.ST.Fwk.InternalExecuter.exe
Problem Signature 02: 12.52.1370.0
Problem Signature 03: 5698f868
Problem Signature 04: System.Net.Http
Problem Signature 05: 4.6.1055.0
Problem Signature 06: 563c0f8b
Problem Signature 07: 295
Problem Signature 08: 46
Problem Signature 09: System.FormatException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1031
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Here is my code for API invocation:
-------------------------------------------------------------------------------------------------------------------------------------
using System.Net.Http;
using System.Threading.Tasks;
async static void ZapiAsync(string url)
{
IEnumerable<KeyValuePair<string, string>> reqContentList = new List<KeyValuePair<string,string>>()
{
new KeyValuePair<string, string>("status","1")
};
HttpContent reqContent = new FormUrlEncodedContent(reqContentList);
reqContent.Headers.Add("Content-Type", "application/json");
reqContent.Headers.Add("Authorization", "Basic SEtBUkJBUzohS2JuX0QxOTg4");
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = await client.PutAsync(url,reqContent))
{
using (HttpContent resContent = response.Content)
{
string content = await resContent.ReadAsStringAsync();
HttpContentHeaders resHeaders = resContent.Headers;
MessageBox.Show(content.ToString());
}
}
}
}
in order to automate my agile (in JIRA) test management, I'm trying to make use of REST APIs in a C# custom code.
To that end, I'm trying to send my request using HttpClient object in an Async function which can be seen at the end of the post.
The issue is that the execution of the code block throws out following runtime problem:
any help is appreciated in advance
HP.ST.Fwk.InternalExecuter.exe has stopped working
Details:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: HP.ST.Fwk.InternalExecuter.exe
Problem Signature 02: 12.52.1370.0
Problem Signature 03: 5698f868
Problem Signature 04: System.Net.Http
Problem Signature 05: 4.6.1055.0
Problem Signature 06: 563c0f8b
Problem Signature 07: 295
Problem Signature 08: 46
Problem Signature 09: System.FormatException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1031
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Here is my code for API invocation:
-------------------------------------------------------------------------------------------------------------------------------------
using System.Net.Http;
using System.Threading.Tasks;
async static void ZapiAsync(string url)
{
IEnumerable<KeyValuePair<string, string>> reqContentList = new List<KeyValuePair<string,string>>()
{
new KeyValuePair<string, string>("status","1")
};
HttpContent reqContent = new FormUrlEncodedContent(reqContentList);
reqContent.Headers.Add("Content-Type", "application/json");
reqContent.Headers.Add("Authorization", "Basic SEtBUkJBUzohS2JuX0QxOTg4");
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = await client.PutAsync(url,reqContent))
{
using (HttpContent resContent = response.Content)
{
string content = await resContent.ReadAsStringAsync();
HttpContentHeaders resHeaders = resContent.Headers;
MessageBox.Show(content.ToString());
}
}
}
}