FogBugz XML API (Cases:)

Go To


I'm consuming the FogBugz XML API but I have a problem. I'm able to create new cases, open created cases, search cases etc through my app. The problem consist of when getting the payload I can get the body of the case using the following piece of code:

        string fbToken = LogOnFogBugz();
        string param = "";

        param += "cmd=search";
        param += "&token=" + fbToken;
        param += "&q="+ "appID["+appID+"]";
        param += "&cols=sTitle,sStatus,sLatestTextSummary";

        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(fbUrl + param);
        httpWebRequest.Method = WebRequestMethods.Http.Post;
        httpWebRequest.Accept = "application/xml";
        httpWebRequest.ContentLength = 0;

        HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
        StreamReader streamReader = new StreamReader(response.GetResponseStream());
        XDocument doc = XDocument.Load(streamReader);

 var cases = from c in doc.Descendants("case")
                    select new
                            CaseNumber = c.Attribute("ixBug").Value,
                            CaseTitle = (string)c.Element("sTitle"),
                            CaseStatus = (string)c.Element("sStatus"),
                            CaseText = (string)c.Element("sLatestTextSummary")

but If I edit the case and add text to it, I only get last entered text as (sLatestTextSummary) implies.

How can I get the whole text from a case using the XML API.


Opened by xxx xxx 4/4/2012 (Today) 10:31 AM ------------------------->Blah Blah Blah

Assigned to xxx xxxx by xxx xxx 4/4/2012 (Today) 10:31 AM

Edited by xxx xxx 4/4/2012 (Today) 2:00 PM ---------------------------->New text.

I'm only getting {new text}.

Thanks in advance.


2012-04-04 19:19
by EdMore


You want to include events as one of your cols arguments. Then for each case you will also have to iterate over the events to get the text out of them.

2012-04-04 22:52
by Michael Pryor
Thank you for pointing me in the correct direction. I missed that (Element) on the payload - EdMore 2012-04-05 14:53
Worth pointing out here that if you just need the "Opened by" or "Edited by" and not the actual "Blah Blah" text of the event, you'll want to use minievents. This will save time and server load - Rich Armstrong 2012-04-09 13:23