Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(Zephyr) REST API invocation
#1
Not Solved
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 Smile

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<stringstring>> reqContentList = new List<KeyValuePair<string,string>>()
            {
                new KeyValuePair<stringstring>("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());
                    }
                }
            }
        }
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CyberArk CorePAS REST API to search for accounts pramod 0 838 06-29-2023, 03:11 PM
Last Post: pramod
  UFT RESTFUL API. Please pass json issue kul20 0 2,290 08-06-2018, 07:16 PM
Last Post: kul20
  UFT API Compilation Error dheena 0 1,737 01-12-2017, 06:23 AM
Last Post: dheena
  How To use iterations for API petchd 1 2,796 12-03-2015, 06:51 PM
Last Post: petchd
  Using LearnQuickTestPDF API loyola1986 0 2,243 08-14-2014, 08:03 PM
Last Post: loyola1986

Forum Jump:


Users browsing this thread: 1 Guest(s)