Read response from CURL.exe program
<p>My objective is to read the response from the CURL.exe file which returns a JSON string when provided with the necessary arguments.</p>

<p>Ex:</p>

<pre><code>curl -u admin:admin http://localhost:8080/jira/rest/api/2.0.alpha1/issue/PROJ-1
</code></pre>

<p>The above code retuns me the following response in JSON format:</p>

<pre><code>{
    "self": "http://localhost:8080/rest/api/2/issue/10000/worklog/10000",
    "author": {
        "self": "http://localhost:8080/rest/api/2/user?username=admin",
        "name": "admin",
        "emailAddress": "admin@admin.com",
        "avatarUrls": {
            "16x16": "http://localhost:8080/secure/useravatar?size=small&amp;avatarId=10122",
            "48x48": "http://localhost:8080/secure/useravatar?avatarId=10122"
        },
        "displayName": "Vamshi Vanga",
        "active": true
    },
    "updateAuthor": {
        "self": "http://localhost:8080/rest/api/2/user?username=admin",
        "name": "admin",
        "emailAddress": "admin@admin.com",
        "avatarUrls": {
            "16x16": "http://localhost:8080/secure/useravatar?size=small&amp;avatarId=10122",
            "48x48": "http://localhost:8080/secure/useravatar?avatarId=10122"
        },
        "displayName": "Vamshi Vanga",
        "active": true
    },
    "comment": "Read the articles and found some plugins to work with.",
    "created": "2012-03-13T14:45:15.816+0530",
    "updated": "2012-03-13T14:45:15.816+0530",
    "started": "2012-03-13T14:44:00.000+0530",
    "timeSpent": "1h",
    "timeSpentSeconds": 3600,
    "id": "10000"
}
</code></pre>

<p>I have implemented this code to fetch the details:</p>

<pre><code>Process myProcess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo("curl.exe -u admin:admin123 http://localhost:8080/jira/rest/api/2.0.alpha1/issue/PROJ-1");        
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
myProcess.StartInfo = startInfo;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.Start();
myProcess.WaitForExit();
StreamReader myStreamReader = myProcess.StandardOutput;
string myString = myStreamReader.ReadLine();
Console.WriteLine("JSON Response" +myString);
myProcess.Close();
Console.ReadLine();
</code></pre>

<p>When the above code is run it does not give me any response in the prompt via code. Howver the command runs fine when I manually run in the Command Prompt.</p>
